</head> <body> <h1>#SingleInstance</h1> <p>스크립트에게 이미 실행 중일 때 다시 실행을 허용할지 결정합니다.</p> <pre class="Syntax"><span class="func">#SingleInstance</span> <span class="optional">ForceIgnorePromptOff</span></pre> <h2 id="Parameters">매개변수</h2> <dl> <dt>ForceIgnorePromptOff</dt> <dd> <p>If this parameter is omitted, it defaults to <em>Prompt</em>. To change this behavior, specify one of the following words:</p> <p><strong>Force:</strong> Skips the dialog box and replaces the old instance automatically, which is similar in effect to the <a href="Reload.htm">Reload</a> command.</p> <p><strong>Ignore:</strong> Skips the dialog box and leaves the old instance running. 즉, 이미 실행 중인 스크립트의 기동 시도를 무시합니다.</p> <p><strong>Prompt:</strong> 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.</p> <p><strong>Off:</strong> Allows multiple instances of the script to run concurrently.</p> </dd> </dl> <h2 id="Remarks">논평</h2> <p>스크립트에 <a href="../Hotkeys.htm">hotkeys</a>, <a href="../Hotstrings.htm">hotstrings</a>, <a href="_Persistent.htm">#Persistent</a>, <a href="OnMessage.htm">OnMessage()</a>, 또는 <a href="Gui.htm">Gui</a>가 담겨 있으면 기본값은 단일-실체입니다 (대화상자가 나타나 &amp; 묻습니다). 다른 스크립트는 기본적으로 다중 실체를 허용합니다. 이 행위는 위에 기술한 것처럼 불능화하거나 변경할 수 있습니다.</p> <p>This directive is ignored when any of the following <a href="../Scripts.htm#cmd">command line switches</a> are used: /force /f /restart /r</p> <p>다른 지시어처럼, #SingleInstance는 조건적으로 실행할 수 없습니다.</p> <h2 id="Limitations">한계</h2> <p>Previous instances of the script are identified by searching for a <a href="../Program.htm#main-window">main window</a> with the <a href="../Program.htm#title">default title</a>. Therefore, a previous instance may not be found if:</p> <ul> <li>The title of its main window has been changed.</li> <li>It is running on a different version of AutoHotkey.</li> <li>Its main window is no longer top-level, such as if the script has used <a href="https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setparent">SetParent</a> to change its parent to something other than NULL (0).</li> </ul> <p>At most one previous instance is detected and sent a message asking it to close. Therefore, the following additional limitations also apply:</p> <ul> <li>If there are multiple instances (such as if previous instances of the script used the <code>#SingleInstance Off</code> mode), the topmost matching instance is sent the message, and other instances are not considered.</li> <li>If the previous instance is running at a higher integrity level than the new instance (where running as administrator &gt; <a href="../Program.htm#Installer_uiAccess">running with UI access</a> &gt; normal), it cannot be closed due to security restrictions.</li> </ul> <p>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.</p> <h2 id="Related">관련 항목</h2> <p><a href="Reload.htm">Reload</a>, <a href="_Persistent.htm">#Persistent</a></p> <h2 id="Examples">예제</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Skips the dialog box and replaces the old instance automatically.</p> <pre>#SingleInstance Force</pre> </div> </body> </html>