IanBrooke
Posts: 6
Joined: Sun Nov 28, 2021 12:39 am

Varying folder locations

I'm wondering if there is a way to vary the path of an installed folder. So, is it possible to check a registry entry and if it exists use it as the path to install a folder and files, if it does not exist use a default path? If so, please explain how. (Professional version)

Thanks
Ian
Liviu
Posts: 1325
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Varying folder locations

Hello Ian,

You can set the default installation path on the Install Parameters page --> Application Folder field.
app folder.png
app folder.png (52.28 KiB) Viewed 11923 times

To check a registry entry, you can use a Search.

1. Go to the Search page.

2. Click on the New Search.

3. Click on the Add Search Location --> Registry.

4. Configure your search to retrieve the desired key value:
search registry.png
search registry.png (105.73 KiB) Viewed 11923 times

5. Go to the Custom Actions page.

6. Add a Set installer property custom action with sequence:

Property: APPDIR
Value: [RESULT_PROPERTY]

7. Hold the SHIFT key and drag it after the Searches action under the Wizard Dialogs Stage.

8. Add the RESULT_PROPERTY condition.
custom action.png
custom action.png (74.09 KiB) Viewed 11923 times

After that, if the registry key exists, its value will be used for the installation path, otherwise the default value will be used.

Attached you can find a sample project.

Hope this helps!

Best regards,
Liviu
Attachments
sample project.aip
(13.8 KiB) Downloaded 258 times
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
IanBrooke
Posts: 6
Joined: Sun Nov 28, 2021 12:39 am

Re: Varying folder locations

Thanks for your reply Liviu. I'm actually unsure if it answers my problem or not.
If I read it correctly it seems to be affecting the install path (the appdir) but that wasn't what I was asking about (I probably didn't explain very well). What I am asking is if I can use a registry key to set the path for a Folder (and its files) defined under "Files and Folders"? If the registry key does not exists then install the folder in a default location.
Liviu
Posts: 1325
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Varying folder locations

Hello Ian,

You can achieve this with a Property Based folder.

1. Create a new property in the Properties page. Set its default value to a valid path.
prop.png
prop.png (66.18 KiB) Viewed 11890 times

2. Go to the Files and Folders page and create a new Property Based folder (use the property you created):
prop based folder.png
prop based folder.png (91.23 KiB) Viewed 11888 times

3. Now for the Set installer property custom action replace the APPDIR property with the new property.
setProperty.png
setProperty.png (93.37 KiB) Viewed 11890 times

Please find attached the modified project.

Best regards,
Liviu
Attachments
sample project.aip
(14.37 KiB) Downloaded 200 times
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”