craft
Posts: 3
Joined: Wed Oct 04, 2006 9:28 am

How to modify some cfg file

I am a newbie for install maker. When the progame is installed, I want to add some texts in the CFG file which is already in windows. Is it possible to add it throught advanced installer?

thanks!
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

This can be done with a custom action. First create a file search to determine the path where the CFG file resides. Now create a custom action that append some text to this file.

Note that the path of the file is stored in the search property. In a VBS custom action you can obtain the value of a property using this code:

Code: Select all

path = Session.Property("RESULT_PROPERTY")
Here is a some VBS examples on how you can append some text to an existing file:
http://www.computerperformance.co.uk/ezine/ezine79.htm

Hope this helps.

Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
craft
Posts: 3
Joined: Wed Oct 04, 2006 9:28 am

Thanks gigi, I already find the way to seach the path in REG.

And thanks for your VBS examples, it is very useful.

But could you tell me some example for search the number in the CFG file like as follows.

In the CFG file, there is some like

Code: Select all

[aaa.001]
...
...

[aaa.002]
... ...


[aaa.011]
... ...
I should find the last number in the CFG file. Do you have some information of example progame for finding the last number so that I can judge the number I want to append.

Thanks a lot.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Here is how you can do this:

Switch to "Files and Folders" page and create under "Windows Volume->Windows" folder a "New INI File".

Name it like the file that already exist. For more details about how to create a INI file please follow this link: http://www.advancedinstaller.com/user-g ... files.html

Hope this helps.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
craft
Posts: 3
Joined: Wed Oct 04, 2006 9:28 am

Thanks Gigi,

I needn't create a ini file, because it is already exist and with more contents before installation. I should modify it and add add some lines.

Now I have solved it through VBScript.

Anyway, thanks.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,
I needn't create a ini file, because it is already exist and with more contents before installation. I should modify it and add add some lines.
No, the file is not overwritten if already exist. You can choose the action to take when a key is created in the INI file from the "Edit INI File" dialog.

I think this solution is more elegant, but its up to you what to use.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Feature Requests”