Variable Commands
The commands below are used to create and change variables.
Syntax: set VARIABLE_NAME value
Syntax: VARIABLE_NAME= value
Syntax: set VARIABLE_NAME value1 operator value2
Syntax: VARIABLE_NAME= value1 operator value2
This command either creates and sets the value of a global variable or it changes the value of an existing global or pre-defined variable. If a local variable exists by the same name, the local variable is changed.
It can also be used to perform basic floating point and integer math, binary operations, logical operations, comparison operations, or concatenate two text strings.
Note that an easier way to set the value of a variable is to reference it by name as the first parameter of a line followed by the "=" character. For example, "set VARIABLE_NAME" just becomes "VARIABLE_NAME=".
Below are some examples:
set IMAGEDIRECTORY "c:\images" |
sets the value of the built-in variable IMAGEDIRECTORY to "c:\images" |
IMAGEDIRECTORY= "c:\images" |
same as above |
YEAR= 2006 |
sets the value of the global variable YEAR to 2006 |
COUNT= $COUNT + 1 |
sets the value of the global variable COUNT to one larger than its current value |
set MESSAGE "Date: " plus $TODAY |
sets the value of the global variable "MESSAGE" to "Date: " plus the value of variable TODAY |
COUNT= $COUNT * $INCREMENT |
sets the value of the global variable "COUNT" to the the previous value of "COUNT" multiplied by the value of variable "INCREMENT" |
Syntax: localset VARIABLE_NAME value
Syntax: localset VARIABLE_NAME (sets VARIABLE_NAME to a null string)
Syntax: VARIABLE_NAME= value (only works after variable created with "localset")
Syntax: VARIABLE_NAME= value1 operator value2 (only works after variable created with "localset")
Syntax: set VARIABLE_NAME value1 operator value2 (only works after variable created with "localset")
This command either creates and sets the value of a variable local to the current script or it changes the value of an existing local variable. It can also be used to perform basic floating point and integer math, binary operations, logical operations, comparison operations, or concatenate two text strings.
Note that an easier way to set the value of a variable is to reference it by name as the first parameter of a line followed by the "=" character. For example, "set VARIABLE_NAME" just becomes "VARIABLE_NAME=". Local variables need to created first before this syntax will work.
Below are some examples:
localset OBJECT M51 |
sets the value of the local variable OBJECT to "M51" |
OBJECT= M57 |
sets the value of the local variable OBJECT to "M57" (variable needs to be already created with localset) |
COUNT= $COUNT * $INCREMENT |
sets the value of the variable "COUNT" to the the previous value of "COUNT" multiplied by the value of variable "INCREMENT" |
Syntax: userset variable_name
This command displays a dialog box that prompts the user to specify a value for the local, global, or pre-defined variable "variable_name".
Syntax: eraseuservariables
This command erases all global user-specified variables.
Syntax: clearerrorvariables
This command sets the state of all error variables to false.