Keeps a script permanently running (that is, until the user closes it or ExitApp is encountered).


If this directive is present anywhere in the script, that script will stay running after the auto-execute section (top part of the script) completes. This is useful in cases where a script contains timers and/or custom menu items but not hotkeys, hotstrings, or any use of OnMessage() or Gui.

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

[v1.0.16+]: This directive also makes a script single-instance. To override this or change the way single-instance behaves, see #SingleInstance.

Like other directives, #Persistent cannot be executed conditionally.

#SingleInstance, SetTimer, Menu, Exit, ExitApp


Causes the script to run permanently; that is, it will not exit automatically if it could.