Introduction to the Variables tab
- Create a variable
- Remove a variable
- Import a Java class as a new variable type
The Variables listbox contains the names of all the variables that have been created for this macro. It allows you to select a variable to edit or to remove, and it also contains a <new variable> entry for creating new variables.
Variable1($strUserName$)
The
string Variable1 is a setting that shows how many variables
you have created. It is not saved in the macro script. The real name
of the variable is $strUserName$, and you should use this
name alone throughout the macro wherever you use the variable.You have probably noticed that the variable name $strUserName$ is enclosed in dollar signs ($). This is a requirement. You must enclose the variable name in dollar signs ($) wherever you use it in the macro.
The Name input field displays the name of the currently selected variable, $strUserName$. You can change the name of the variable by typing over the old name. Mostly you should use this field only for assigning a name to a newly created variable. Although you can come back later at any time and change the name of this variable (for example to $strUserFirstName$), remember that you might have already used the variable's old name elsewhere in the macro, in some action or descriptor. If you change the name here in the Variables tab, then you must also go back to every place in the macro where you have you used the variable and change the old variable name to the new variable name.
You can choose any variable name you like, although there are a few restrictions on the characters you can choose (see Variable names and type names). You do not have to choose names that begin with an abbreviated form of the data type (such as the str in the string variable $strUserName$), as this book does.
string
integer
double
boolean
field
java.util.Hashtable
You should use this listbox for assigning a type
to a newly created variable. You can come back later and change the
variable's type to another type, but, as with variable names, remember
that you might have already used the variable throughout the macro
in contexts that require the type that you initially selected. If
so, you must go to each of those places and make sure that the context
in which you are using the variable is appropriate for its new type.Type of variable: | Default initial value: |
---|---|
string | No string |
integer | 0 |
double | 0.0 |
boolean | false |
field | (No initial value) |
(any imported type) | null |
The Remove button removes the currently selected variable.
The Import button and the Import popup window are discussed in Creating an imported type for a Java class.