RobwEllis
Posts: 7
Joined: Thu Jul 02, 2009 11:20 pm

Populating a PathEdit box

Hi,

Is it possible to populate a PathEdit box on the folder dlg with a default value from either an Environment variable or registry entry?

If my users are installing an upgrade, I want their database folder to be populated by the location they last used rather than my default for a new installation which is “[CommonApplicationData]\MyCo\MyApp\”.

I can get the last location used into an environment variable or registry entry using a custom action. I just can't get it from there into the PathEdit box.

Thanks in advance

Rob
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Populating a PathEdit box

Hi,

In your custom action you can put the located path into a new property, different from APPDIR, which you can define in the Install Parameters page, in the Properties group.
- Now go to Custom Actions page, on the InstallUISequence folder, right click on it → Show Standard Actions → CostFinalize.
- Right click on CostFinalize → New Custom Action → Directory Set with Formatted.
- In the Custom Actions Properties page you are interested in the following fields :
--- Directory , this should have the value APPDIR, leave it that way.
--- Formated Text, here you set the name of your new property like this : [MY_NEW_PROPERTY]
--- and the Execute Condition group, in the Expression field write this : (MY_NEW_PROPERTY)
This way you will condition the custom action to run only if the value of the property is not NULL.
For getting the value of an Environment Variable that stores the installation path the you can use the following format : [% NAME_OF_THE_VARIABLE], this property contains the entire path of installation.
For capturing the install path from a registry entry you can make a New Registry Search in the Search page. The value of the search is returned by its name, which is a property, and you can place it in the Format Text field and in the Execute Condition group as mentioned above.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”