Reading and Updating an INI - Advanced Installer Community
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Reading and Updating an INI

Hello,

I would like to create an installer that provides the following functionality...

First time installation - Files get installed. All files are installed under [AI_ProgramFiles]\TCS Healthcare\[ProductName]. One of the files that is installed is an ini file that will be configured as part of the installation. I have created a "Config" dialog that captures the values that get written to the ini file. This works just fine. When the installer is run for the first time, the ini file does not exist on the target machine so there are no values that can be retrieved from the ini file and thus there are no values to display in the "Config" dialog.

When the installer is run in "Maintenance/Repair" mode, I need to read the ini file (that was created during the first time installation) and display the values on the "Config" dialog. This I am unable to do! I believe the issue is that Advanced Installer, when being run in "Maintenance/Repair" mode does not see the location of where the ini file is due to the timing of when my "Search" properties are evaluated and when the predefined properties I am using to specify the PATH to the ini location are determined. I say this because:

1. If I specify the Path of the ini to be in a folder identified as [APPDIR] or [AI_ProgramFiles]\TCS Healthcare\[ProductName] the "Search" properties are not being set (i.e. the ini values do not display on the "Config" dialog). It would seem that when the "Search" is performed to get the ini values, the Advanced Installer "predefined" properties have yet to be defined/determined.

2. If I specify the path of the ini to be [WindowsVolume]\[ProductName] the "Search" properties are being found in the ini file. It would seem that when my "Search" is performed using these "predefined" properties, that they are defined.

Note, the installer does not install the ini in [WindowsVolume]\[ProductName] but rather in [AI_ProgramFiles]\TCS Healthcare\[ProductName]. For testing purposes, I manually created the ini in [WindowsVolume]\[ProductName] to test my theory that it could be found and that the ini values displayed on the "Config" dialog.

I need to be able to install the ini file (and configure it's content) when the installer is run for the first time. All subsequent attempts to run the installer in "Maintenance/Repair" mode need to be able to:
- Find the ini file that was originally installed based on the location of where the application was installed.
- Display the ini values in the "Config" dialog
- Update the ini file that was originally installed.

This would seem to be a common task that an installer would need to perform. Please explain what I am doing wrong and how I can accomplish this.

Thanks in advance,

Todd
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Reading and Updating an INI

Hello Todd,

Most likely this happens because the "AI_ProgramFiles" and "APPDIR" properties are resolved during "CostFinalize" standard action, after the "AppSearch" action is executed. Can you move "AppSearch" after "CostFinalize" and see if this helps?

You can also take a look on our "Perform a search in Application Folder during uninstall" article which exposes a similar scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Re: Reading and Updating an INI

Hi Daniel,

I am new to Advanced Installer so I apologize but could you provide me with suggestions as it relates to the installer scenarios I provided? The link you provided doesn't really answer the question that I am asking (or I am just not getting it).

Again, the installer will install an ini file that will be configured during the "first time" the installer is run. For example, the ini file will be updated with the name of a server and database so that when the installed application runs, it will read the ini file to get the server and database to use.

If the user attempts to run the installer again (i.e. maintenance/repair), then the installer needs to read the ini file to get the server and database in order to display those values on a dialog.

Thanks in advance,

Todd
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Re: Reading and Updating an INI

Hi Daniel,

I did try moving "AppSearch" after "CostFinalize" and this did not help when the installer is run a second time (i.e. Maintenance/Repair)... the values were not retrieved from the INI file.

Todd
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Reading and Updating an INI

Hello Todd,

To get a clear view of your installation scenario, can you please send us the .aip (project file) to support at advancedinstaller dot com so we can investigate its settings?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tscheuerman
Posts: 43
Joined: Thu Feb 11, 2016 11:39 pm

Re: Reading and Updating an INI

Hello,

I was finally able to accomplish what I needed by creating a Custom Action in a dll to obtain the needed values from the ini file.

I would image that this type of functionality would be very common in an installer... sure would be nice to have this built into Advanced Installer.

Thanks,

Todd

Return to “Common Problems”