Page 1 of 1

How to edit an installed ini file

Posted: Fri Mar 31, 2006 6:26 am
by crustyzz
Hi,
I would like to edit an ini file wich will be installed. But I read I can't call Edit Ini file after the Apply Install command because this is a Windows Installer command.

Should I call Edit Ini File command before Apply install (in the DEFINE WEB MEDIA bloc ?) using SFXPATH valiable, to edit my ini file?

I would like something like that.

Code: Select all

Install Files E:\\MyLocalFilePath\\MyIniFile.opt to $TARGETDIR$\\MyDestDir\\MyIniFile.opt
...
Apply Install (get result into variable success)
If Varible MyCustomVariable Equals 1
  Edit INI File $TARGETDIR$\\MyDestDir\\MyIniFile.opt, [MySection] var=value1
else
    Edit INI File $TARGETDIR$\\MyDestDir\\MyIniFile.opt, [MySection] var=value2
End


But this doesn't work !

Can you help please ?

Thanks

Posted: Fri Mar 31, 2006 9:21 am
by jimo
Move your edits before the apply install but after the file installation.

As in:

Code: Select all

Install Files E:\\MyLocalFilePath\\MyIniFile.opt to $TARGETDIR$\\MyDestDir\\MyIniFile.opt
...
If Varible MyCustomVariable Equals 1
  Edit INI File $TARGETDIR$\\MyDestDir\\MyIniFile.opt, [MySection] var=value1
else
    Edit INI File $TARGETDIR$\\MyDestDir\\MyIniFile.opt, [MySection] var=value2
End
Apply Install (get result into variable success)

Posted: Fri Mar 31, 2006 9:57 am
by crustyzz
Thanks Jimo,

but this doen't work. I think it's because MyIniFile.opt isn't copied to local system until the script call Apply Install.

In fact the test "Does File exist $TARGETDIR$/../MyIniFile.opt" return FALSE before I call "Apply Install" but TRUE after.

:cry:

Posted: Fri Mar 31, 2006 10:07 am
by jimo
I use this all the time,

I install my ini files then use Edit INI File

Here is an excerpt from one of my functioning scripts

Code: Select all

Install Files E:\\MDDI_INSTALL\\DIR_ROOT\\Program Files\\MultiMedia Dental\\MDDI\\ctpCore.ini to $TARGETDIR$\\MDDI
Edit INI File $TARGETDIR$\\MDDI\\ctpCore.ini, [CONFIG] Practitioner=$CONFIG_PRACTICE_NAME$
Edit INI File $TARGETDIR$\\MDDI\\ctpCore.ini, [CONFIG] StatusTemplatePath=$MASTER_IMAGES_PATH$\\StatusTemplates

Posted: Mon Apr 03, 2006 8:13 am
by crustyzz
Thanks Jimo for your help.
That works !

BUT ... My Ini file contains a checksum :oops: and I would like to calculate the new checksum when the file will be copied, and Edit the file to update a value.

I'm developping a plugin in order to calculate the new check sum.
I hope I would be able to edit my ini file just after the last editions.

I saw a "File contains a checksum" check box in the file properties, but I don't know how to use it.

Does anybody know more about this option?

Posted: Mon Apr 03, 2006 3:00 pm
by MichaelNesmith
The checksum option is for when you're installing files. From what I understand you are storing the INI checksum as part of the INI file itself, so that's not what you're looking for.