#SingleInstance

스크립트에게 이미 실행 중일 때 다시 실행을 허용할지 결정합니다.

#SingleInstance ForceIgnorePromptOff

매개변수

ForceIgnorePromptOff

If this parameter is omitted, it defaults to Prompt. 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. 즉, 이미 실행 중인 스크립트의 기동 시도를 무시합니다.

Prompt: Displays a dialog box asking whether to keep the old instance or replace it with the new one. This is the default behaviour if this directive is not used.

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

논평

스크립트에 hotkeys, hotstrings, #Persistent, OnMessage(), 또는 Gui가 담겨 있으면 기본값은 단일-실체입니다 (대화상자가 나타나 & 묻습니다). 다른 스크립트는 기본적으로 다중 실체를 허용합니다. 이 행위는 위에 기술한 것처럼 불능화하거나 변경할 수 있습니다.

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

다른 지시어처럼, #SingleInstance는 조건적으로 실행할 수 없습니다.

한계

Previous instances of the script are identified by searching for a main window with the default title. Therefore, a previous instance may not be found if:

At most one previous instance is detected and sent a message asking it to close. Therefore, the following additional limitations also apply:

If multiple instances of the script are started simultaneously, they may fail to detect each other or may all target the same previous instance. This would result in multiple instances of the script starting.

Reload, #Persistent

예제

Skips the dialog box and replaces the old instance automatically.

#SingleInstance Force