ExitApp

Terminates the script.

ExitApp , ExitCode

Parameters

ExitCode

If blank or omitted, it defaults to 0 (zero is traditionally used to indicate success). Otherwise, specify an integer between -2147483648 and 2147483647 (or in [v1.0.48.01+] an expression) that is returned to its caller when the script exits. This code is accessible to any program that spawned the script, such as another script (via RunWait) or a batch (.bat) file.

Remarks

This is equivalent to choosing "Exit" from the script's tray menu or main menu.

Any function or subroutine registered by OnExit will be called automatically, and may prevent the script from terminating. In such a case, the current thread exits as if Exit was called.

Terminating the script is not the same as exiting each thread. For instance, Finally blocks are not executed and __Delete is not called for objects contained by local variables.

Exit, OnExit, #Persistent

Examples

Press a hotkey to terminate the script.

#x::ExitApp  ; Win+X