Task involving reading and writing files - 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!

J. Merrill
Posts: 2
Joined: Fri Jan 04, 2008 1:00 am

Task involving reading and writing files

Our software wants to write information to the .INI file that is used to describe and control its own invocation. That file is normally in the Windows directory (a legacy of the way MS said to do things in the past), so it can't be written to by our program when that program is running under a limited account on Vista.

The information we need to write into the .INI file has to be determined dynamically. (It has to include the path to a 3rd-party product with which we are interfacing.) The name of the .INI file can also vary (to support multiple installs of our app, each has its own .INI file).

Our running software could easily put a file in a writeable location (e.g. Application Data\{current user}\companyname\) containing the name of the .INI file and the data that needs to be written to the .INI file. It could then run an MSI that does the work by reading that file to find out what to do, then writing to the appropriate file. I want an easy way to build that MSI.

It seems that using a Javascript / VBScript file would be the best way to do this. Are there any examples of doing such things? Does anyone have any hints / tips / gotchas to tell me about? Am I right that this would require the not-free version of the software?

Thanks for any input.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

You do not need to use a custom action because Advanced Installer offers support for INI files:
http://www.advancedinstaller.com/user-g ... files.html
http://www.advancedinstaller.com/user-g ... ialog.html
Am I right that this would require the not-free version of the software?
Yes, the INI files support is available only in a Professional, Java Application and Enterprise project (which requires a license). You can use our trial version (it offers full access to all Advanced Installer features) to see if you can create the installation package you need.
http://www.advancedinstaller.com/download.html

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
J. Merrill
Posts: 2
Joined: Fri Jan 04, 2008 1:00 am

[quote="cosmin"]
You do not need to use a custom action because Advanced Installer offers support for INI files:
http://www.advancedinstaller.com/user-g ... files.html
http://www.advancedinstaller.com/user-g ... ialog.html
[quote]

I don't see how, without a custom action, I could make it so that the values that I would enter into the edit-ini-file dialog if they were constant can be changed based on the contents of a different (possibly .INI) file? That is, I have to dynamically get the values to put into various places in the target .INI file; the target .INI file's name is also not knowable until runtime.

If I could get at-runtime access to the data structure that the edit-ini-file dialog stores, with the ability to change it using some kind of scripting, that would make things easier. But I expect that I'll need to "do it all" (read the input file and write to the output file) in a script.

Thanks for your help.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

Please note that most of the fields in the "Edit INI File", "New INI Section" and "New INI Entry" dialogs are formatted, therefore you can use properties for the dynamic values.

Also, if you need to retrieve custom values, you can use a custom action. In order to write these custom values in the INI file, the custom action will set the properties you used for the INI.

You can read more about custom actions here:
http://www.advancedinstaller.com/user-g ... -page.html

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”