Interacting with an .INI file - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

tmcallaghan
Posts: 16
Joined: Thu Mar 24, 2011 2:38 pm

Interacting with an .INI file

First of all, great product. I'm finding some of the functionality difficult to learn, although I haven't found something I can't do yet.

I need my installer to do the following:
1. allow the user to choose the directory they are installing into. (simple)
2. if there is a file named inventory.ini in that directory, I want AI to read it's keys and value (most of them at least)
3. if this is a new install or inventory.ini does not exist, I want AI to get a default inventory.ini from my installer
4. some of the key/value pairs are presented to the user (enter a string or select a directory) so they may be changed by the installer
5. when the install runs I need to end up with a edited/new inventory.ini with the initial file plus edits or my default file plus edits

Seems like normal use-case, searching the FAQ/Forums presents me with so many directions (some of them saying "this feature is not available yet").

Thanks in advance,

Tim
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Interacting with an .INI file

Hi Tim,
if there is a file named inventory.ini in that directory, I want AI to read it's keys and value (most of them at least)
If the user defines the installation directory, then you cannot use the Search Page to search for the .INI. Editing a .INI already present on the target machine is also not supported by our predefined functionality. However, you can implement the search and get the values from the .INI yourself from within your own custom action.
if this is a new install or inventory.ini does not exist, I want AI to get a default inventory.ini from my installer
some of the key/value pairs are presented to the user (enter a string or select a directory) so they may be changed by the installer
when the install runs I need to end up with a edited/new inventory.ini with the initial file plus edits or my default file plus edits
You can work with the .INI file you have imported or defined from the File and Folders Page inside the .INI editor. Here you can have formatted references to public properties which you can also link to controls in the Dialogs Page. These references will be resolved at install time after user interaction.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tmcallaghan
Posts: 16
Joined: Thu Mar 24, 2011 2:38 pm

Re: Interacting with an .INI file

So I'd need to write a VBScript custom action to open the existing .ini file (if it exists) and grab the existing values I'm interested in, defaulting to my pre-defined values if they are not present?

I really do love your product so far but your implementation of user defined scripting is extremely non-intuitive.

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

Re: Interacting with an .INI file

Hi Tim,
So I'd need to write a VBScript custom action to open the existing .ini file (if it exists) and grab the existing values I'm interested in, defaulting to my pre-defined values if they are not present?
Your custom actions should only retrieve the values from the INI and set the public properties with them. If the INI file is not found then you don't need to set any property, the defaults will automatically be set by the INI file
from the Files and Folders page.

Another option, I am not sure if this meets, your requirements is to simply use the INI file from the Files and Folders page. If Windows Installer find the INI file
in the install location it will automatically update the changed pairs from the file If the file is not present at all it will be created from scratch. Attached you can find a small sample project which simply updates an entry from the file with the installation path, i.e. APPDIR.

If you need to get the values from the existent INI file on the machine, if found, then an UI custom action is mandatory.

Regards,
Bogdan
Attachments
testing INI.zip
(207.15 KiB) Downloaded 390 times
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”