#SingleInstance


Determines whether a script is allowed to run again when it is already running.

#SingleInstance [force|ignore|off]

Parameters

force|ignore|off

This parameter determines what happens when a script is launched while a previous instance of itself is already running. If #SingleInstance is specified by itself (with no parameter), a dialog box is displayed asking whether to keep the old instance or replace it with the new one. Otherwise:

The word FORCE skips the dialog box and replaces the old instance automatically, which is similar in effect to the Reload command.

The word IGNORE skips the dialog box and leaves the old instance running. In other words, attempts to launch an already-running script are ignored.

The word OFF allows multiple instances of a script.

Remarks

A script containing hotkeys, hotstrings, #Persistent, OnMessage(), or Gui is single-instance by default. This behavior can be disabled or modified as described above.

Related

Reload, #Persistent

Example

#SingleInstance force
#SingleInstance ignore
#SingleInstance off