leeroy
Posts: 28
Joined: Mon May 03, 2021 11:13 pm

Check if File Exists and Present Dialog

Hi,

I'm trying to build an installer, that during the install of a newer version checks to see if a configuration file exists from the previous version and presents a dialog to keep the previous configuration or install "normally" if you will.

My thoughts are to have a custom action that hangs off the next button on the dialog before the verify ready dialog and present an optional dialog if the config is found with a checkbox to keep the previous config, but I'm not entirely sure how to do this.

Any help is much appreciated.

Kind regards,
Lee
leeroy
Posts: 28
Joined: Mon May 03, 2021 11:13 pm

Re: Check if File Exists and Present Dialog

I see there is a "show only if", but not sure how to apply a custom action here...
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Check if File Exists and Present Dialog

Hello,

In order to achieve what you need, you can proceed in two ways:

1. have a search that looks for your file

2. do the search through a custom action. If the file is found, set a property e.g. FILE_FOUND="true". If not, set the property to FILE_FOUND="false"

After doing so, you can use the "Show only if" option just as you mentioned and, as a condition, you can use the "FILE_FOUND" property and its value.

The custom action should be scheduled right after the "Searches" action group in the "Custom Actions" page.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
leeroy
Posts: 28
Joined: Mon May 03, 2021 11:13 pm

Re: Check if File Exists and Present Dialog

Thanks Catalin, that works great! The only thing I found odd, was I applied the "show only if" to the wrong dialog initially and reverting that change did not seem trivial, it required moving dialogs deleting what appeared to be sub dialogs etc. There didn't seem to be a way to remove or alter the condition to restore the previous state.
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Check if File Exists and Present Dialog

Hello,

You are always welcome!

Glad to hear everything is working as expected.
The only thing I found odd, was I applied the "show only if" to the wrong dialog initially and reverting that change did not seem trivial, it required moving dialogs deleting what appeared to be sub dialogs etc. There didn't seem to be a way to remove or alter the condition to restore the previous state.
You are indeed right about that.

Unfortunately, the only possible way to easily revert that is right after you made the change by using the "Undo" operation (CTRL + Z).

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”