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.

file update

1 reply to this topic


  • Members
  • 7 posts

Posted 12 June 2003 - 05:20


I am a newbie to Installshield application. I am trying to create a new package for a certain applicaton of mine..As part of it, I need to add three constant lines at the end of a windows text document present in a certain directory.

Lets say the document (..\system32\etc\folders\services.txt) is always present here...Thru installshied, I need to open this services.txt and append three lines at the end of this document. Lets say the three lines are:
Line1 Input11 Port 1111
Line2 Output11 Port 1112
Line3 Error11 Port 1113

How do I go about updating this through installshield scripts...


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 15 June 2003 - 09:27

This is pretty simple to do. The code would go something like the following:

NUMBER nResult, nvFileHandle;
STRING szPath, szFilename;

szPath = <Specifies the path (which may include a drive designation), of the file you want to open.>
szFilename <Specifies the unqualified name (that is, without a drive designation or path ) of the file you want to open.>

nResult = OpenFileMode(FILE_MODE_APPEND);
nResult = OpenFile(nvFileHandle, szPath, szFileName);

if (nResult = 0) then
 nResult = WriteLine(nvFileHandle, "Input11 Port 1111");
 nResult = WriteLine(nvFileHandle, "Output11 Port 1112");
 nResult = WriteLine(nvFileHandle, "Error11 Port 1113");

 nResult = CloseFile(nvFileHandle);
 MessageBox("Unable to open the file '"+szPath^szFilename"'.", WARNING);

NOTE: I didn't compile this code, but it should be close to syntactically correct. Also, you should have better error checking/handling in your actual code like testing the individual WriteLine results, but this will at least get you going.

By the way, welcome to InstallShield.

Edited by TacoBell00, 15 June 2003 - 09:30.

user posted image