Complex appdir search on registry and folders - Advanced Installer Community
dcorbitt
Posts: 6
Joined: Wed Jan 08, 2014 11:09 pm

Complex appdir search on registry and folders

I’m evaluating the trial version, and I’m having trouble getting past a way to set the volume for our AppDir.

Our software is typically installed on the D drive, but it could be on another drive.

If the registry is already set with our install path (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OurApp), then of course I’d want to continue to install there. The reg value would be of the form, “D:\OurInstallFolder\”. (I see where I could also search for the folder “OurInstallFolder” on all fixed drives.) I'd like to not give an option to change the appdir in this case.

If the registry is not set (= first time install), then I’d like to launch the Installation Folder dialog box defaulted to “D:\OurInstallFolder\” if the D drive exists as fixed drive, otherwise to the “[WindowsVolume]:\OurInstallFolder\”.

So, it seems a bit complex … If reg value, then reg value with no dialog for path, else if D drive exists, then dialog defaulted to D plus foldername else dialog defaulted to C plus foldername.

How could I do this?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Complex appdir search on registry and folders

Hi and welcome to Advanced Installer forums.

Thank you for your interest in Advanced Installer.

In order to achieve what you want you can follow the steps below:
- go in the Install Parameters page and create a new property using the [Property] toolbar button like in the example:
  • Name: DRIVE
    Value: D:\
- in the "Application Folder" field replace the [ProgramFilesFolder] property with the [DRIVE] property
- go in the Upgrades page and check the "Use original installation path when upgrading" option
- follow the steps described in the Setting APPDIR to dir on a drive which may not exist thread to find if a drive exists
- go in the Custom Actions page and add a new "Set installer property" custom action after the "Wizard Dialogs Stage -> Searches" action group with the following configuration:
  • Property: DRIVE
    Value: [WindowsVolume]
    Condition: NOT DRIVE_SEARCH
    (the custom action will be executed only if the searched drive was not found)
- press the SHIFT keyboard button and drag and drop the custom action after the "Install Execution Stage -> Searches" action group (this will duplicate it)
- click on the "Advanced Execution Scenarios" blue link and select the "Skip action in Install Execution Stage if executed in Dialogs Stage" option (the duplicated custom action will be executed if the package is installed with Basic UI or in silent mode)
- go in the Dialogs page, right-click on the "FolderDlg" dialog and choose the "Show only if..." option
- in the newly appeared dialog write the following condition: NOT OLDPRODUCTS (in this case the "FolderDlg" will be displayed only if an older version of the application is not found on the machine, only at first time install)
- build and run the project

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dcorbitt
Posts: 6
Joined: Wed Jan 08, 2014 11:09 pm

Re: Complex appdir search on registry and folders

Thank you for the quick response. I took it one step at a time, but I’m missing something.

This first part is good:
Under Product Info/Install Parameters, I have a property called “DRIVE” with a value “D:\”, and I replaced [ProgramFilesFolder] with [DRIVE] as the Application Folder.

Testing with this much only, the install dialog defaults to the path on the D drive, as expected.

Under Custom Behavior/Search, I then added a Search called “DRIVE_SEARCH” that looks for the D drive. When I test it, it displays “1: D:\”. That looks right.

This is what’s not working right:
Under Custom Behavior/Custom Actions, I added a new “Set installer property” action under Wizard Dialog Stage -> Searches. The property, value, and condition are set as you described. I selected all the values using the prompts from the program, so they are correctly capitalized, etc.

Testing only with this, the installation dialog prompt always begins with the C drive.

If I change the condition to NOT DRIVE_SEARCH EQV "D:\", I still get drive C every time.

What have I missed to this point?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Complex appdir search on registry and folders

Hi,

I'm not sure why you encounter this problem, I tested it and it worked well to me.

What I forgot to mention is that you should set the same condition for both "Set installer property" custom action that you create under the "Wizard Dialogs Stage -> Searches" and "Install Execution Stage -> Searches" action groups.

I also attached a sample AIP file, so you can take a look of it and test it.

Best regards,
Eusebiu
Attachments
Change APPDIR.aip
(11.69 KiB) Downloaded 361 times
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dcorbitt
Posts: 6
Joined: Wed Jan 08, 2014 11:09 pm

Re: Complex appdir search on registry and folders

Than you for the sample to help me identify the problem.

Initially, I didn't see a difference in the UI, but comparing the projects in WinMerge, I found that your Drive_Search had the signature, "AppSearchSign," while mine incorrectly had the signature, "FileSearchSign." On the search page, I was running the "Test" on the folder search sub-node, but I gather that the installer was evaluating the "file search" node above it.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Complex appdir search on registry and folders

You're welcome. Glad to help.

Just let us know anytime you need help.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”