Var

Top  Previous  Next

 

The Var command allows you to define Variables that can then be used within the script. If defined in the Setup Section the variable is global in scope and can be used in any script section. If you declare them in the Notification or User Sections they are only available in that particular section. Once defined you use them in the script by typing in the variable name surrounded with percent symbol pairs.

lamp Note: Once declared the variables can be used in any subsequent command, and even in subsequent variable declarations.

A common use for this is to declare a long base file path once which is then used with multiple commands. Another is to define Version information and then generate different expressions of that information for various purposes (e.g. separated by dots for version text and by underscores where they will be embedded in file names).

 

Command Syntax

 

Var:[VariableName][AssignmentSeparator][VariableValue]

 

The colon after the command and the parameters are compulsory. Any additional spaces or characters will cause an error to be thrown. The command itself is not case sensitive, but parameters may be depending on the operating system and locale.

 

Parameters:

 

VariableName: The name used to identify the variable elsewhere in the script

AssignmentSeparator: Either a comma or an equals sign. These can be used interchangeably according to preference and either will have the same effect as the other.

VariableValue: The value to be assigned to the variable

 

All parameters are compulsory. If any parameter is missing or invalid an error will be thrown.

 

Example:

 

Var:Major,1

Var:Minor,0

Var:Build,0

Var:Revision,123

Var:Version=%%Major%%.%%Minor%%.%%Build%%.%%Revision%%

Var:FileNameVersion=%%Major%%_%%Minor%%_%%Build%%_%%Revision%%

 

See Also: Special Functions Variables Subs