Using a Persistent variable I need to set it to a default value if it is not already initialized from a previous execution.
I've seen from the debugger that a command like
Set Variable SELECT to $MyVariable$
takes the value "$MyVariable$" (the name surrounded by $ sign) if the variable is not defined, so I've try to check if the variable SELECT contain a $ sign.
... but I've got a lot of strange error :
1) Runtime error in insall: cannot open the file "{omiss}\\Temp\\mia13\\.dfm" (note that file name is empty)
2) Runtime error in install: List index out of bouns (25)
depend on how I try to test it.
could you help me ?
How can I check for a variable not defined ?
-
- Posts: 22
- Joined: Tue Mar 14, 2006 6:29 am
-
- Posts: 3452
- Joined: Thu Dec 22, 2005 7:17 pm
- Contact:
Interesting case...I don't think testing if a variable has been defined is supported (as confirmed by your test results).
The proper approach is to make sure the persistent variable is always defined on each run of your software. This will be guaranteed if you make sure you define it the very first time setup runs. There is a nice place to do this in your script, the same place that initializes the TARGETDIR and STARTMENU variables to their initial values (these variables are persisted automatically).
The proper approach is to make sure the persistent variable is always defined on each run of your software. This will be guaranteed if you make sure you define it the very first time setup runs. There is a nice place to do this in your script, the same place that initializes the TARGETDIR and STARTMENU variables to their initial values (these variables are persisted automatically).
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
-
- Posts: 22
- Joined: Tue Mar 14, 2006 6:29 am
But with the new #LOADOLDDATA# I don't know if the variable is already defined, by loading of setup data from an older prduct version, or this is a first installation and I must initialize all my variables.
Also I need to modify the initialization of TARGETDIR and STARTMENU variables so it's previous value is not overvritten by default values.
Also I need to modify the initialization of TARGETDIR and STARTMENU variables so it's previous value is not overvritten by default values.
-
- Posts: 3452
- Joined: Thu Dec 22, 2005 7:17 pm
- Contact:
That's why LOADOLDDATA is optional 

Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
-
- Posts: 22
- Joined: Tue Mar 14, 2006 6:29 am
Workaround
The following code work.
The parse command is the only way I found to set a variable to a dollar sign, getting the first of a two dollar sign

The parse command is the only way I found to set a variable to a dollar sign, getting the first of a two dollar sign

Code: Select all
Comment: load only 1 caracter
Parse String $$ into Variables DOLLAR and (Split at position from start)
Set Variable SELECTED to $MYVARIABLE$
if Variable MYVARIABLE Contains $DOLLAR$
Comment: initialize default value
Set Persistent Variable MYVARIABLE to INITIALVALUE
end

Who is online
Users browsing this forum: Google [Bot] and 109 guests