Page 1 of 1

Persistent variable

Posted: Mon Jun 26, 2006 5:18 am
by maurosturaro
Sorry I've not undestood how to use persistent variable.

I've seen that the first reference of a variable in the script must be a 'Set Variable' or I get a runtime error of 'Attenpting to get value of undefined variable'.

But doing so I overvrite the persisted value that i can see in the debugger.

What's wrong in my usage ?

Posted: Mon Jun 26, 2006 5:14 pm
by MichaelNesmith
You could say:

Code: Select all

if Variable MAINTENANCE Equals FALSE
  Set Persistent Variable MYVARIABLE to VALUE
end


all the way on top of your script. This way the compiler will be happy, and the variable will not be overwritten on future runs of your script.

Note: The typical place for this type of first-time initialization in the setup code is the place marked:

Code: Select all

  Comment: First Time Install


in the setup script. Choose "Comments" on the left combo box and "First Time Install" in the right combo box (both located on top of your script, below the tabs) to quickly locate this place.