Variables start with a single dollar sign ($) followed by the variable name. The name can contain letters (a–z), numbers (0–9), and the underscore character (_). The length of a variable name is not limited. Variable names are case-insensitive, $abc is the same as $ABC. You can assign numbers and strings to a variable. Strings must be enclosed in double quotation marks ("..."). An explicit declaration is not required.


You can assign the following values to a variable:


  • Number
  • String, enclosed in double quotation marks ("...")
  • Another variable
  • Result of a built-in function


Example:

$i = 1
$string = "This is a string"
$s = $string
$result = GetQuestionBoxResult

Numeric operations

For numeric calculations, you can use the following operations:


  • variable = Operand1 + Operand2
  • variable = Operand1 - Operand2
  • variable = Operand1 * Operand2
  • variable = Operand1 / Operand2


Operand1 and Operand2 can be numbers, other variables, or the result of a built-in function.

String operations

For strings, you can use the following operation:


  • variable = Operand1 + Operand2


Operand1 and Operand2 can be strings, other variables, or the result of a built-in function.


Example:

$i = 1
$i2 = $i + 10
$s = "Text1"
$s2 = "Text2"
$s3 = $s1 + $s2


Please note that only one operation per line is allowed.

Variables in MessageBox and other commands

Variables can also be used in the MessageBox command and in the parameters of all other commands. If you place the variable name between { and }, it is automatically replaced with the value of the variable.


Example:

$i = 1
$s = "Text1"
MessageBox "Value of i is {$i} and value of s is {$s}"

$dynamic_filename = GetUniqueID + ".htm"
CreateReport /template="{bookmarkdir}changes.htm" (+)
             /output="e:\{$dynamic_filename}" (+)
             /bookmarks=changed