SetGlobal
void SetGlobal(int option, int value)Description
Configures a global script setting identified by option.
This function replaces the former SetNotFoundBehavior and provides a unified way to control global behavior flags.
Parameter
- option - The global setting to change. Use one of the predefined constants:
GLOBAL_NOT_FOUND_BEHAVIOR - Controls what happens when a UI control cannot be found.
GLOBAL_SCREENSHOT_ON_NOT_FOUND - Controls whether a screenshot is taken when a UI control cannot be found.
- value - The value to assign to the setting:
For GLOBAL_NOT_FOUND_BEHAVIOR: Use NOTFOUND_ABORT (default) or NOTFOUND_WARN.
For GLOBAL_SCREENSHOT_ON_NOT_FOUND: Use 1 to enable, 0 to disable (default).
Return
- void
Example
void main()
{
// Switch to warning mode - missing controls no longer abort the test
SetGlobal(GLOBAL_NOT_FOUND_BEHAVIOR, NOTFOUND_WARN);
// Enable screenshot when a control is not found
SetGlobal(GLOBAL_SCREENSHOT_ON_NOT_FOUND, 1);
LeftMouseClick("myOptionalButton"); // logs warning + screenshot if not found
// Restore defaults
SetGlobal(GLOBAL_NOT_FOUND_BEHAVIOR, NOTFOUND_ABORT);
SetGlobal(GLOBAL_SCREENSHOT_ON_NOT_FOUND, 0);
}