This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- help with script
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 09, 2015
11:31 AM
help with script
Hi, I cannot figure out why this script is not working. It is a very basic file creation based upon a value the user enters. Can someone please see if I am doing something wrong, or if maybe it's a problem with Installshield? The user prompt gets asked, but the newfile.mss does not get created. I am also using Installshield 2009 on windows 7. I have created many similar scripts but this is the first script I've created in IS2009 on windows 7. Many thanks in advance.
NUMBER nvSrYes;
NUMBER nvSrNo;
STRING szSrYes;
STRING szSrNo;
NUMBER nFileHandle;
NUMBER nvFileHandle;
STRING szFileName;
STRING szPath;
STRING szLine;
STRING szLine2;
export prototype SupervisorRelay();
Dlg_SdAskSupvRelay:
ConfSupvRelay:
SetDialogTitle(DLG_ASK_OPTIONS, "ARD supervisor or relay position?");
szMsg = "Is this a relay or supervisor position?";
szSrYes = "Yes";
szSrNo = "No";
nvSrYes = FALSE;
nvSrNo = TRUE;
nValue = EXCLUSIVE;
nResult = AskOptions (nValue, szMsg,
szSrYes, nvSrYes,
szSrNo, nvSrNo);
function SupervisorRelay()
string szFileName[255];
string szPath[255];
string szLine[255];
number nFileHandle;
number nvFileHandle;
begin
OpenFileMode(FILE_MODE_APPEND);
szFileName = "newfile.mss";
szPath = INSTALLDIR;
if ( nvSrYes = TRUE )then
szLine = "REM ARD Relay Supervisor Interface flag: Y = ARD N = Relay/Supv";
szLine2 = "assign $80 'N'";
WriteLine(nFileHandle, szLine);
WriteLine(nFileHandle, szLine2);
endif;
if ( nvSrNo = TRUE )then
szLine = "REM ARD Relay Supervisor Interface flag: Y = ARD N = Relay/Supv";
szLine2 = "assign $80 'Y'";
WriteLine(nFileHandle, szLine);
WriteLine(nFileHandle, szLine2);
endif;
end;
NUMBER nvSrYes;
NUMBER nvSrNo;
STRING szSrYes;
STRING szSrNo;
NUMBER nFileHandle;
NUMBER nvFileHandle;
STRING szFileName;
STRING szPath;
STRING szLine;
STRING szLine2;
export prototype SupervisorRelay();
Dlg_SdAskSupvRelay:
ConfSupvRelay:
SetDialogTitle(DLG_ASK_OPTIONS, "ARD supervisor or relay position?");
szMsg = "Is this a relay or supervisor position?";
szSrYes = "Yes";
szSrNo = "No";
nvSrYes = FALSE;
nvSrNo = TRUE;
nValue = EXCLUSIVE;
nResult = AskOptions (nValue, szMsg,
szSrYes, nvSrYes,
szSrNo, nvSrNo);
function SupervisorRelay()
string szFileName[255];
string szPath[255];
string szLine[255];
number nFileHandle;
number nvFileHandle;
begin
OpenFileMode(FILE_MODE_APPEND);
szFileName = "newfile.mss";
szPath = INSTALLDIR;
if ( nvSrYes = TRUE )then
szLine = "REM ARD Relay Supervisor Interface flag: Y = ARD N = Relay/Supv";
szLine2 = "assign $80 'N'";
WriteLine(nFileHandle, szLine);
WriteLine(nFileHandle, szLine2);
endif;
if ( nvSrNo = TRUE )then
szLine = "REM ARD Relay Supervisor Interface flag: Y = ARD N = Relay/Supv";
szLine2 = "assign $80 'Y'";
WriteLine(nFileHandle, szLine);
WriteLine(nFileHandle, szLine2);
endif;
end;
- Tags:
- scripting help
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 11, 2015
12:41 PM
I am unable to get that script to compile as written, but in regards to the SupervisorRelay() function, it looks like you are missing either a CreateFile() or OpenFile() call before your WriteLine()
"The WriteLine function writes a line of text to a text file opened in append mode. You must first set the file mode to append mode with OpenFileMode, and then either create the file with CreateFile, or open the file with OpenFile, before calling WriteLine. This function places the line at the end of the file."
source: http://helpnet.flexerasoftware.com/installshield19helplib/Subsystems/installshield19langref/helplibrary/LangrefWriteLine.htm
HTH
"The WriteLine function writes a line of text to a text file opened in append mode. You must first set the file mode to append mode with OpenFileMode, and then either create the file with CreateFile, or open the file with OpenFile, before calling WriteLine. This function places the line at the end of the file."
source: http://helpnet.flexerasoftware.com/installshield19helplib/Subsystems/installshield19langref/helplibrary/LangrefWriteLine.htm
HTH