Prevents the script from exiting automatically when its last thread completes, allowing it to stay running in an idle state.

Persistent Persist



Type: Boolean

If true or omitted, the script will be kept running after all threads have exited, even if none of the other conditions for keeping the script running are met.

If false, the default behaviour is restored.

Return Value

Type: Integer (boolean)

This function returns the previous value of the global setting; either 0 (false, the default value) or 1 (true).


If the script is persistent, it will stay running after startup completes and all other threads have exited. It is usually unnecessary to call this function because the script is automatically persistent in most of the common cases where the user would want it to keep running, such as to respond to hotkeys, execute timers or display a GUI.

Some cases where this function might be needed (if it is intended to stay running when there are no running threads or hotkeys, timers, etc.) include:

If this function is added to an existing script, some or all occurrences of Exit might need to be changed to ExitApp. This is because Exit will not terminate a persistent script; it terminates only the current thread.

Exit, ExitApp


Prevent the script from exiting automatically.

; This script will not exit automatically, even though it has nothing to do.
; However, you can use its tray icon to open the script in an editor, or to
; launch Window Spy or the Help file.