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.
Photo

INI file uses angle brackets <>


2 replies to this topic

nnjcsc

nnjcsc
  • Full Members
  • 13 posts

Posted 11 March 2008 - 17:28

I have to update a .INI file that does not use square brackets [] around the section names. Instead, the .INI file has less than, greater than or angle brackets <>.

The built-in initialization file functions like WriteProfString, only recognize the square brackets [].

Is there a way to change the WriteProfString to recognize the angle brackets <>?

Is there InstallScript code for the WriteProfString and other initialization file functions?


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 12 March 2008 - 15:15

No. InstallShield uses the corresponding Windows API which only supports the Windows INI format, i.e. only square brackets. Yur file is not a Windows INI file, it only "happens to use the same .ini extension". So you'll have to use general text file editiong functions.

nnjcsc

nnjcsc
  • Full Members
  • 13 posts

Posted 17 March 2008 - 21:21

Thanks. I resolved it. Here is how I had to do it. I had to update a number of values in an INI file that had angle brackets <> around the section. I had to find the section using FileGrep, then restart the FileGrep again for the next value. So I had to repeat the FileGrep with the RESTART followed by a FileGrep with a CONTINUE. Hope this helps someone else one day.

//Find and replace Server
szSearchStr = "Server"; // value I'm looking to change.
szInsertLine = " Server = "+svValueIwantToChange;
szSectionName = "SECTION_WITH_ANGLE_BRACKETS";

FileGrep (szFileName , szSectionName , svReturnLine , nvLineNumber , RESTART );

if FileGrep (szFileName , szSearchStr , svReturnLine , nvLineNumber , CONTINUE ) = 0 then

FileInsertLine ( szFileName , szInsertLine , nvLineNumber , REPLACE );
else
put error messsage/logging here......
endif;