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
- :
- assing [ComputerName] to szLine parameter
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
‎May 20, 2008
12:18 PM
assing [ComputerName] to szLine parameter
hii...
i want to assign or say pass [computerName] to parameter szLine of
predefine function EzBatchAddString (szLine, szRefKey, nOptions).
i want to do it because i want to set the environment variable in batch file to
this value(ComputerName)
But when i set
szline=[ComputerName]
or
szLine=ComputerName
the compiler complaints for an error...
can u plz tell me how can i achieve this.
thanks
jagjit
i want to assign or say pass [computerName] to parameter szLine of
predefine function EzBatchAddString (szLine, szRefKey, nOptions).
i want to do it because i want to set the environment variable in batch file to
this value(ComputerName)
But when i set
szline=[ComputerName]
or
szLine=ComputerName
the compiler complaints for an error...
can u plz tell me how can i achieve this.
thanks
jagjit
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 20, 2008
12:54 PM
I would suggest to first retrieve the value of ComputerName environment variable in a string and then pass it on to another function. Use GetEnvVar function to resolve the environment variable value:
GetEnvVar("ComputerName", sCompName);
Then use sCompName like any other variable in the Ez functions.
GetEnvVar("ComputerName", sCompName);
Then use sCompName like any other variable in the Ez functions.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 20, 2008
01:37 PM
hi
when i added this function into my code..upon compilation i encountered 50 errors
this is my code
can u plz tell me where's the error
#include "ifx.h"
export prototype MyFunction(HWND);
STRING szLine, szRefKey;
NUMBER nOptions;
STRING sCompname
function MyFunction(hMSI)
// To Do: Declare local variables.
begin
#define BATCH_FILE "C:\\ISExampl.bat"
// Include Ifx.h for built-in InstallScript function prototypes.
GetEnvVar("ComputerName",sCompname);
// Set the default batch file.
BatchSetFileName (BATCH_FILE);
// Set up parameters for next call to EzBatchAddString.
szLine = "rem This is the first line of the file.";
szRefKey = "";
nOptions = BEFORE|NOSET;
// Add a comment line to the top of the batch file.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("First call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("First call to EzBatchAddString successful.", INFORMATION);
endif;
// Set up parameters for next call to EzBatchAddString.
szLine = "TEMP=C:\\EXAPP3";
szRefKey = "PATH";
nOptions = AFTER;
// Add a line after the PATH statement.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("Second call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("Second call to EzBatchAddString successful.", INFORMATION);
endif;
// Set up parameters for next call to EzBatchAddString.
szLine = "C:\\EXAPP3\\EXAPP.EXE";
szRefKey = "TEMP";
nOptions = AFTER|NOSET;
// Add a command line after the SET TEMP statement.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("Third call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("Third call to EzBatchAddString successful.", INFORMATION);
endif;
// Set up parameters for next call to EzBatchAddString.
szLine = "PATH=C:\\;C:\\Windows";
szRefKey = "PATH";
nOptions = AFTER|NOSET|REPLACE|COMMAND;
// Replace the PATH statement.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("Fourth call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("Fourth call to EzBatchAddString successful.", INFORMATION);
endif;
//endprogram
end;
when i added this function into my code..upon compilation i encountered 50 errors
this is my code
can u plz tell me where's the error
#include "ifx.h"
export prototype MyFunction(HWND);
STRING szLine, szRefKey;
NUMBER nOptions;
STRING sCompname
function MyFunction(hMSI)
// To Do: Declare local variables.
begin
#define BATCH_FILE "C:\\ISExampl.bat"
// Include Ifx.h for built-in InstallScript function prototypes.
GetEnvVar("ComputerName",sCompname);
// Set the default batch file.
BatchSetFileName (BATCH_FILE);
// Set up parameters for next call to EzBatchAddString.
szLine = "rem This is the first line of the file.";
szRefKey = "";
nOptions = BEFORE|NOSET;
// Add a comment line to the top of the batch file.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("First call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("First call to EzBatchAddString successful.", INFORMATION);
endif;
// Set up parameters for next call to EzBatchAddString.
szLine = "TEMP=C:\\EXAPP3";
szRefKey = "PATH";
nOptions = AFTER;
// Add a line after the PATH statement.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("Second call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("Second call to EzBatchAddString successful.", INFORMATION);
endif;
// Set up parameters for next call to EzBatchAddString.
szLine = "C:\\EXAPP3\\EXAPP.EXE";
szRefKey = "TEMP";
nOptions = AFTER|NOSET;
// Add a command line after the SET TEMP statement.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("Third call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("Third call to EzBatchAddString successful.", INFORMATION);
endif;
// Set up parameters for next call to EzBatchAddString.
szLine = "PATH=C:\\;C:\\Windows";
szRefKey = "PATH";
nOptions = AFTER|NOSET|REPLACE|COMMAND;
// Replace the PATH statement.
if (EzBatchAddString (szLine, szRefKey, nOptions) < 0) then
MessageBox ("Fourth call to EzBatchAddString failed.", SEVERE);
else
MessageBox ("Fourth call to EzBatchAddString successful.", INFORMATION);
endif;
//endprogram
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 20, 2008
01:42 PM
Tough...I can tell but I have to recompile it. Since I am a lazy guy, would you mind copy the errors you are encountering? Please....
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 20, 2008
02:19 PM
these are the errors which i encountered when i jst added these two lines in the code
STRING sCompname
GetEnvVar("ComputerName",sCompname);
following are errors generated only by the addition of these two lines in the code
InstallShield Script Compiler
Version 14.0.0.162
Copyright 1997-2006 Macrovision Europe Ltd. and/or Macrovision Corporation. All Rights Reserved.
Compiling...
setup.rul
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(48) : error C8022: 'STRING' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(61) : error C8022: 'function' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(83) : error C8017: 'szRefKey' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(83) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(83) : error C8008: '' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(84) : error C8017: 'nOptions' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(84) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(84) : error C8008: '1' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8019: 'if' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8008: '(' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8014: 'EzBatchAddString' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8025: 'szLine' : undefined identifier
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8014: 'szRefKey' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8014: 'nOptions' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(91) : error C8008: '0xFFFF0003' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(91) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(92) : error C8019: 'else' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8014: 'MessageBox' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8038: 'First call to EzBatchAddString successful.' : numeric value required
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8008: '0xFFFF0001' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(94) : error C8019: 'endif' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(97) : error C8017: 'szLine' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(97) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(97) : error C8008: 'TEMP=C:\EXAPP3' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(98) : error C8017: 'szRefKey' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(98) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(98) : error C8008: 'PATH' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(99) : error C8017: 'nOptions' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(99) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(99) : error C8008: '0' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8019: 'if' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8008: '(' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8014: 'EzBatchAddString' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8025: 'szLine' : undefined identifier
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8014: 'szRefKey' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8014: 'nOptions' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(103) : error C8008: '0xFFFF0003' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(103) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(104) : error C8019: 'else' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8014: 'MessageBox' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8038: 'Second call to EzBatchAddString successful.' : numeric value required
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8008: '0xFFFF0001' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(106) : error C8019: 'endif' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : error C8017: 'szLine' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : error C8008: 'C:\EXAPP3\EXAPP.EXE' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : fatal error F8516: maximum error count reached
Setup.inx - 51 error(s), 0 warning(s)
STRING sCompname
GetEnvVar("ComputerName",sCompname);
following are errors generated only by the addition of these two lines in the code
InstallShield Script Compiler
Version 14.0.0.162
Copyright 1997-2006 Macrovision Europe Ltd. and/or Macrovision Corporation. All Rights Reserved.
Compiling...
setup.rul
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(48) : error C8022: 'STRING' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(61) : error C8022: 'function' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(83) : error C8017: 'szRefKey' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(83) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(83) : error C8008: '' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(84) : error C8017: 'nOptions' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(84) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(84) : error C8008: '1' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8019: 'if' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8008: '(' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8014: 'EzBatchAddString' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8025: 'szLine' : undefined identifier
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8014: 'szRefKey' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8014: 'nOptions' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(90) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(91) : error C8008: '0xFFFF0003' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(91) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(92) : error C8019: 'else' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8014: 'MessageBox' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8038: 'First call to EzBatchAddString successful.' : numeric value required
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8008: '0xFFFF0001' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(93) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(94) : error C8019: 'endif' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(97) : error C8017: 'szLine' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(97) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(97) : error C8008: 'TEMP=C:\EXAPP3' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(98) : error C8017: 'szRefKey' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(98) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(98) : error C8008: 'PATH' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(99) : error C8017: 'nOptions' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(99) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(99) : error C8008: '0' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8019: 'if' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8008: '(' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8014: 'EzBatchAddString' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8025: 'szLine' : undefined identifier
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8014: 'szRefKey' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8014: 'nOptions' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(102) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(103) : error C8008: '0xFFFF0003' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(103) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(104) : error C8019: 'else' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8014: 'MessageBox' : identifier already defined
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8038: 'Second call to EzBatchAddString successful.' : numeric value required
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8008: '0xFFFF0001' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(105) : error C8022: ')' : comma or semicolon expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(106) : error C8019: 'endif' : expected type declaration
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : error C8017: 'szLine' : expected typedef (struct) name
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : error C8008: '=' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : error C8008: 'C:\EXAPP3\EXAPP.EXE' : identifier expected
C:\InstallShield 2008 Projects\My Project Name-4\script files\setup.rul(109) : fatal error F8516: maximum error count reached
Setup.inx - 51 error(s), 0 warning(s)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 20, 2008
02:54 PM
You'll want to add a semicolon after this line:
STRING sCompname
to make it:
STRING sCompname;
STRING sCompname
to make it:
STRING sCompname;