#define
DescriptionThe #define directive defines a named constant or text substitution (macro) that is replaced throughout the script before execution.
It works similarly to the C preprocessor: every occurrence of the defined name in the code is replaced with the specified value before parsing.
#define directives are processed at the very beginning, before any other interpretation takes place.
Syntax
#define NAME value
Rules
- NAME must be a valid identifier (letters, digits, underscores; must not start with a digit).
- value is optional. If omitted, the name is replaced with an empty string.
- Replacements are word-boundary aware: only whole identifiers are replaced, not partial matches inside other identifiers.
- Replacements do not occur inside string literals or comments.
- A #define line is not visible to the parser and does not affect line numbering.
Example
#define MAX_RETRIES 5
#define LOGIN_BTN "BTN_LOGIN"
#define TIMEOUT 30000
void main()
{
StartAUT(TIMEOUT);
int retries = 0;
while (retries < MAX_RETRIES)
{
LeftMouseClick(LOGIN_BTN);
retries++;
}
}