Commands & Syntax >

Macro Variables

www.perfectkeyboard.com

 

Variables 
There are these types of variables:

Macro local variables - The variable name can be any string (characters such +, -, \, /, <, >, *, :, (, ), [, ] cannot not be used) and the variable scope is only in a single macro. The macro variable is enclosed in % like in this example:
Customer name: %varCustName%; Customer phone: %varCustPhone%

Global variables - there are two types of global variables that differ by scope:
   - macro global variable - the variable is known in all the macros (called from each other using <run> command) during the macro execution.  The macro global variable must begin with the "gm_" prefix (for example, "gm_varName").
   - application global variable - the variable is known during the whole application session (the value is remembered until the program is closed).  The application global variable must begin with the "ga_" prefix (for example, "ga_varCurrentProject").

System variables - the variables provide system dependent information and typically are read-only.

Procedure Parameters - if a procedure parameter starts with "par" prefix (for example, "parInputText") then the parameter is local only within the procedure.  Otherwise the parameter is either macro local or global as described above.

Local procedure variables - if a variable defined within a procedure starts with "lpv" (local procedure variable) prefix (for example, "lpvTemporaryVariable") then the variable is known and can be accessed only within the procedure.

Variable Array
Any variable (except system variables) can be used also as an array without any special declaration.  For the array, this syntax is used:
 varVariableName[index]

For the multiple dimension arrays this syntax is used: varVariableName[index1:index2:index3:....:indexN].

Array variables do not have a value assigned automatically.  Until the user assigns a value to a given variable (for example, using <varset>("vName[10]=John","") command) the variable value does not exist.  This can be detected using "_vDoesVariableExist_VARNAME" system variable (_vDoesVariableExist_vName[10] from our example).  The system variable "_vDoesVariableExist_VARNAME" contains 0 if the variable does not exist or 1 if it does.

Environment Variables
The program also recognizes Windows system environment variables such as %ProgramFiles% and such environment variables can be used in macros.