Variables - Macros

Far Manager

Variables

You can use the variables to store some values associated with the names and use them later in the macro sequences. Both global and local variables can be used in the macro sequence.

Naming

Local variable name begins with the '%' sign followed by the alpha characters, numbers or '_' characters.

Global variable name begins with the '%%' signs followed by the alpha characters, numbers or '_' characters.

Variable value assignment should be ended with ';'

Variable names are not case sensitive thus '%myStr' and '%MYstr' is the same variable.

Types

Variables can be either string or integer.

Integer constants can be represented by: NNN - decimal constant, 0NNN - octal constant, 0xNNN - hexadecimal constant.

Integers are of 64 bit width.

Scope of action

The scope for the local variables is the current macro sequence.

The scope for the global variables is a current FAR Manager session. Global variables can be stored in the Vars execution area. Every time FAR starts up it restores the global variables stored in this area.

Representation in registry

In the registry, global variables are stored in the special key [HKEY_CURRENT_USER\Software\Far\[Users\USERNAME\]KeyMacros\Vars].

Every global variable has a name and can be of three types REG_SZ (for string variables) and REG_DWORD or REG_QDWORD (for integer variables). If a variable had REG_DWORD type initially, it changes type to REG_QDWORD during saving with msave function.

Notes

  1. It is impossible to use macro-language elements while recording a macro in a usual way. Macro-language elements can be added to the sequence only by editing the registry manually or by using special applications or FAR plugins.
See also: