#SingleInstance

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

#SingleInstance ForceIgnoreOff

Parameters

ForceIgnoreOff

If this parameter is omitted, a dialog box is displayed asking whether to keep the old instance or replace it with the new one. To change this behavior, specify one of the following words:

Force: Skips the dialog box and replaces the old instance automatically, which is similar in effect to the Reload command.

Ignore: Skips the dialog box and leaves the old instance running. In other words, attempts to launch an already-running script are ignored.

Off: Allows multiple instances of the script to run concurrently.

Remarks

A script containing hotkeys, hotstrings, #Persistent, OnMessage(), or Gui is single-instance (dialog & prompt) by default. Other scripts default to allowing multiple instances. This behavior can be disabled or modified as described above.

This directive is ignored when any of the following command line switches are used: /force /f /restart /r

AutoHotkey relies on the title of the script's main window to identify other running instances of the script.

Related

Reload, #Persistent

Example

#SingleInstance force
#SingleInstance ignore
#SingleInstance off