anoop
Posts: 40
Joined: Tue Jan 10, 2012 12:07 pm

Dynamic folder path based on Registry Condition

Hey Guys,

Hope you all doing good.I wana thank for all the support you have been providing.

Well i'm struck in a situation where in i need to build installer which takes a dynamic value of a folder path in XML configuration file. Let me give a small example.

We have a application called Viewer where in which it stores some files. And this application is built with AI itself. Now i'm building a new installer for another application. This application at the time of installation, AI should check on the particular Reg entry of a Viewer. If the Reg entry is present then while installing in the XML config file it should automatically take the path where the VIEWER is installed else it should take a default value which is given at the time of building installer.

By default this Viewer application gets installed in LOCALAPPDATAFOLDER.

So guys can anyone have any solution for this???

Thanks in advance :)
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Dynamic folder path based on Registry Condition

Hello,

In order to achieve this you can use a registry search (i.e. VIEWER_REG) which will search for the related Viewer application path. Then, you can set a property (i.e. MY_PATH) with the related registry search property (VIEWER_REG) if registry search succeeds or with a default location (i.e. LocalAppDataFolder) if the related registry search fails. Finally you can add to your config XML file a new XML element with an attribute containing MY_PATH property value.

Here's the steps to proceed:
- Go to "Search" page and add the related registry search (VIEWER_REG).
- Go to "Custom Actions" page and add two "Set installer property" custom actions with sequence, after "Install Execution Stage" -> "Searches" action group, like this:
  • Property: MY_PATH
    Formatted: [LocalAppDataFolder]
    Condition: NOT VIEWER

    Property: MY_PATH
    Formatted: [VIEWER]
    Condition: VIEWER
- Go to "Files and Folders" page and create an XML file (i.e. Config.xml) using "New XML File" context menu option.
- Select Config.xml file and from its context menu choose "Properties..." option. In the "Edit XML File" dialog add a a new XML element with the following attribute:
  • Name: Viewer_Path
    Value: [MY_PATH]
- Build and run your project.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
anoop
Posts: 40
Joined: Tue Jan 10, 2012 12:07 pm

Re: Dynamic folder path based on Registry Condition

Thanks :) well let me try with this and get back :)

Return to “Building Installers”