Constants
You can use the constants to store values associated with the names and use them later in the macro sequences.
Naming
Names of the constants should comply with these rules:
- Name should begin from the english letter, and can contain in arbitrary order english letters, digits, and '_' symbol.
- Name should not coincide with predefined boolean states, macro functions names, names of the keys, and other macro states.
Types
Constants 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.
Area of effect
The scope for the constants is a current FAR Manager session.
Representation in registry
In the registry, constants are stored in the special key [HKEY_CURRENT_USER\Software\Far\[Users\USERNAME\]KeyMacros\Consts]
.
Every constant has a name and can be of three types REG_SZ (for string constants) and REG_DWORD or REG_QDWORD (for integer constants).
Remarks
- 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.
Example
Example of using FIB_PASSWORD constant (0x00000002) for prompt function
REGEDIT [HKEY_CURRENT_USER\Software\Far\KeyMacros\Consts] "FIB_PASSWORD"=dword:00000002 [HKEY_CURRENT_USER\Software\Far\KeyMacros\Editor\CtrlP] "Sequence"="%s=prompt(\"Password\",\"Input password:\",FIB_PASSWORD); $Text %s" "DisableOutput"=dword:00000001
See also: