#SingleInstance

Prevents more than one instance of a script from existing simultaneously.

#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. Omitting this parameter will display a dialog box asking whether to keep the old instance or replace it with the new one.

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