Problems with variables in evaluation install

Got a problem you cannot solve? Try here.
Post Reply
LarsS
Posts: 18
Joined: Mon Nov 19, 2007 8:03 pm

Problems with variables in evaluation install

Post by LarsS »

Hi,
I am using the eval version to try making a install that matches our current one made in Wise.

Problem 1:
I want to grab a parameter from the command line if specified or else use a default value set in the script using the following code:
if variable CMDLINEPARAM1 Is Defined
Set Variable ACTUALPARAM1 = CMDLINEPARAM1
else
Set Variable ACTUALPARAM1 = DefaultValue
end
However when I build I get the error "Variable not defined: CMDLINEPARAM1". Is this a bug or have I misunderstood the purpose of "Is defined"?

Problem 2:
When using the pre defined var GPOPATH I also get the "Variable not defined" error.

Question:
When using a rzCheckBox in the dialog designer is the only way to set the initial value from a script variable to use the "via label capton" workaround? Would have expected it to be possible to just use the variable as input just as for edits....

Best regards,

Lars Sondergaard
LarsS
Posts: 18
Joined: Mon Nov 19, 2007 8:03 pm

Still looking for an answer

Post by LarsS »

Any chance of having an answer to this before my eval period expires?
Alex_Ronquillo
Site Admin
Posts: 364
Joined: Mon Jul 30, 2007 11:51 am
Location: USA
Contact:

Post by Alex_Ronquillo »

LarsS,

Code: Select all

if variable CMDLINEPARAM1 Is Defined
actually checks whether CMDLINEPARAM1 variable has a value or not, not if it has been defined. You need to define every variable dereference in IA before building your project, otherwise you will get this error.
When using the pre defined var GPOPATH I also get the "Variable not defined" error.
That is really strange, make sure you are writing the right variable. GPOPATH is always defined.
When using a rzCheckBox in the dialog designer is the only way to set the initial value from a script variable to use the "via label capton" workaround? Would have expected it to be possible to just use the variable as input just as for edits....
If in your script, before the dialog with your rzCheckBox, you set the value of the variable you are using in the rzCheckBox to TRUE , its default value will be checked, and if you set it to FALSE it will be unchecked
Alejandro Ronquillo
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
LarsS
Posts: 18
Joined: Mon Nov 19, 2007 8:03 pm

Post by LarsS »

Thanks for the answer. However I still have the problems:

1. If all variables must be defined with a "Set Variable" how is it then possible to find out IF a variable was specified on the commandline or not? If the user specified a variable on the command line using "Set variable" will clear that value.
Maybe I am asking the wrong way. What I want to do is use the value supplied on the commandline if present and if the commandline does not contain a value then use a value hardcoded in the script.

2. I created a new blank project and onyl added the following lines of script:
if Variable GPOPATH not Equals TesValue
MessageBox: Hello, Yes it works
end

This gives an error message "Variable not defined: GPOPATH".

Thanks for any help.

Best regards

Lars Sondergaard
Alex_Ronquillo
Site Admin
Posts: 364
Joined: Mon Jul 30, 2007 11:51 am
Location: USA
Contact:

Post by Alex_Ronquillo »

What I want to do is use the value supplied on the commandline if present and if the commandline does not contain a value then use a value hardcoded in the script.
Do the following:

Code: Select all

if Variable CMDLINE Contains (Ignore Case) CMDLINEPARAM1=
   Comment: Use the value of CMDLINEPARAM1 directly
else
   Set Variable CMDLINEPARAM1 to Default Value
end
I created a new blank project and onyl added the following lines of script:
if Variable GPOPATH not Equals TesValue
MessageBox: Hello, Yes it works
end
This gives an error message "Variable not defined: GPOPATH".
You are right, try the following instead:

Code: Select all

Set Variable GPOPATHVAR to $GPOPATH$
if Variable GPOPATHVAR not Equals TesValue
   MessageBox: Hello, Yes it works
end
Alejandro Ronquillo
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
rasmusw
Posts: 44
Joined: Tue May 19, 2009 3:06 am

Re: Problems with variables in evaluation install

Post by rasmusw »

I have the same problem with GPOPATH, it was in 9.0 and is still there in 9.0 R2. - The compiler fails when using "IF GPOPATH".
The workaround works, though.
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Problems with variables in evaluation install

Post by MichaelNesmith »

If has a new "Is Variable Defined" query now, actually. So you don't need to rely on the workaround and can test directly.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
rasmusw
Posts: 44
Joined: Tue May 19, 2009 3:06 am

Re: Problems with variables in evaluation install

Post by rasmusw »

The problem is not with the actual check. The problem is that the compiler fails with the message "Variable not defined: GPOPATH" on this line:

Code: Select all

If Variable GPOPATH not Equals NULL
Changing it to

Code: Select all

if Variable GPOPATH is Defined
makes no difference. The compiler still fails.

Changing the code to this works (the workaround suggested by Alex_Ronquillo):

Code: Select all

Set Variable GPOPATHVAR to $GPOPATH$
if Variable GPOPATHVAR not Equals NULL
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Problems with variables in evaluation install

Post by MichaelNesmith »

The compiler should not choke on an "Is Variable Defined" query. I was able to reproduce this easily and have escalated it to R&D. Thanks!
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Problems with variables in evaluation install

Post by MichaelNesmith »

Also, here is a useful codeform:

Code: Select all

 if Variable CMDLINE Contains (Ignore Case) VARTOTEST
   Set Variable VARTOTEST to $VARTOTEST$
 end
This lets you easily sniff custom parameters from the command line and insert them into properly defined variables.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Post Reply