Using the value that the variable holds
A variable that belongs to a standard type (string, integer, double,
boolean) can be used in much the same way as an immediate value of
the same type (such as 'Elm Street', 10, 4.6e-2, true):
- Except for the restrictions listed later in this subsection, a variable of standard type can be used in any input field (in the Macro Editor) or attribute (in the Code Editor) in which an immediate value of the same data type can be used. For example, if an input field (such as the Message Text field on the Message action window) requires a string value, then the field likewise accepts a string variable. See Equivalents.
- Variables can be used with operators and expressions in the same ways that immediate values of the same types are used. See Operators and expressions.
- The value of a variable occurring in a context different from the type of the variable is converted, if possible, to a value of the correct type, in the same way that an immediate value of the same type is converted. See Automatic data type conversion.
However, you cannot use a variable in certain contexts. In the
Macro Editor, you cannot use a variable in the following contexts:
- Any field on the General tab.
- The Screen Name field on the Screens tab.
- The value of any field in the PlayMacro action window.
In the Code Editor, you cannot use a variable in the following
contexts:
- The name of an attribute of any element.
- The value of any attribute of an <HAScript> element.
- The value of the name attribute of a <screen> element.
- The value of the uselogic attribute of the <description> element.
- The name of a macro screen in a <nextscreen> element.
- The value of any attribute of a <playmacro> element.