Jump to content

This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

overwriting settings in an .ini file

1 reply to this topic


  • Full Members
  • 50 posts

Posted 27 January 2005 - 15:48

I have two applications in a new installation which the user has the option of "activating." If they choose to activate, the app name is added to an application list in an .ini file. If they choose not to, the commented out name is added to the app list (so they can activate it later if they have a change of heart).

The problem is that in the previous installation, the apps were installed without querying the user, so that upgrading users who run this installation will already have the two apps listed in their .ini file. I am trying to find a good solution for 1) checking to see if the apps are listed in the ini from a previous install, and 2) if so, over-writing them, or at least removing them and then updating the .ini as necessary.

Thanks in advance for any assistance one could offer...

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 28 January 2005 - 03:05

Well there are a variety of built-in functions designed for manipulating INI files. To learn about them, check the "Overview: Initialization file functions" help topic.

However, it sounds like your existing INI is messed up enough that you should just read the whole thing into memory and re-write it from scratch with the required data.

To do this, you can either use the ListReadFromFile function and then walk through the resulting list, -or- process it line by line via the GetLine function. For more information on the latter, check the "Reading from a text file" help topic for some sample code.

Hope it helps and sorry if my reply was too generic, but have to start somewhere. wink.gif
user posted image