</head> <body> <h1>Pause</h1> <p>Pauses the script's <a href="../misc/Threads.htm">current thread</a>.</p> <pre class="Syntax"><span class="func">Pause</span> <span class="optional">, OnOffToggle, OperateOnUnderlyingThread</span></pre> <h2 id="Parameters">Parâmetros</h2> <dl> <dt>OnOffToggle</dt> <dd><p>If blank or omitted, it defaults to Toggle. Otherwise, specify one of the following words:</p> <p><strong>Toggle</strong>: Pauses the <a href="../misc/Threads.htm">current thread</a> unless the thread beneath it is paused, in which case the underlying thread is unpaused.</p> <p><strong>On</strong>: Pauses the current thread.</p> <p><strong>Off</strong>: If the thread beneath the current thread is paused, it will be in an unpaused state when resumed. Otherwise, the command has no effect.</p> <p><span class="ver">[v1.1.30+]:</span> The decimal values 1, 0 and -1 may be used in place of On, Off and Toggle, respectively.</p> </dd> <dt>OperateOnUnderlyingThread</dt> <dd><p>This parameter is ignored for <code>Pause Off</code> because that always operates on the underlying thread. For the others, it is ignored unless Pause is being turned on (including via Toggle).</p> <p>Specify one of the following numbers:</p> <p><strong>0</strong> (or omitted): The command pauses the current thread; that is, the one now running the Pause command.</p> <p><strong>1</strong>: The command marks the thread beneath the current thread as paused so that when it resumes, it will finish the command it was running (if any) and then enter a paused state. If there is no thread beneath the current thread, the script itself is paused, which prevents <a href="SetTimer.htm">timers</a> from running (this effect is the same as having used the menu item "Pause Script" while the script has no threads).</p> <p class="note"><strong>Observação</strong>: <a href="../Variables.htm#IsPaused">A_IsPaused</a> contains the pause state of the underlying thread.</p></dd> </dl> <h2 id="Remarks">Remarks</h2> <p>By default, the script can also be paused via its <a href="../Program.htm#tray-icon">tray icon</a> or <a href="../Program.htm#main-window">main window</a>.</p> <p>Unlike <a href="Suspend.htm">Suspend</a> -- which disables <a href="../Hotkeys.htm">hotkeys</a> and <a href="../Hotstrings.htm">hotstrings</a> -- turning on pause will freeze the <a href="../misc/Threads.htm"> current thread</a>. As a side-effect, any interrupted threads beneath it will lie dormant.</p> <p>Whenever any thread is paused, <a href="SetTimer.htm">timers</a> will not run. By contrast, explicitly launched threads such as <a href="../Hotkeys.htm">hotkeys</a> and <a href="Menu.htm">menu items</a> can still be launched; but when their <a href="../misc/Threads.htm">threads</a> finish, the underlying thread will still be paused. In other words, each thread can be paused independently of the others.</p> <p>The color of the tray icon changes from green to red whenever the script's <a href="../misc/Threads.htm">current thread</a> is in a paused state. This color change can be avoided by freezing the icon, which is achieved by specifying 1 for the last parameter of the Menu command. Por exemplo:</p> <pre><a href="Menu.htm">Menu</a>, Tray, Icon, C:\My Icon.ico, , 1</pre> <p>To disable <a href="SetTimer.htm">timers</a> without pausing the script, use <a href="Thread.htm">Thread, NoTimers</a>.</p> <p>A script is always halted (though not officially paused) while it is displaying any kind of <a href="Menu.htm">menu</a> (tray menu, menu bar, GUI context menu, etc.)</p> <h2 id="Related">Tópicos relacionados</h2> <p><a href="Suspend.htm">Suspend</a>, <a href="Menu.htm">Menu</a>, <a href="ExitApp.htm">ExitApp</a>, <a href="../misc/Threads.htm">Threads</a>, <a href="SetTimer.htm">SetTimer</a></p> <h2 id="Examples">Exemplos</h2> <div class="ex" id="ExHotkey"> <p><a class="ex_number" href="#ExHotkey"></a> Press a hotkey once to pause the script. Press it again to unpause.</p> <pre>Pause::Pause <em>; The Pause/Break key.</em> #p::Pause <em>; Win+P</em></pre> </div> <div class="ex" id="PostMessage"> <p><a class="ex_number" href="#PostMessage"></a> Sends a Pause command to another script.</p> <pre><a href="DetectHiddenWindows.htm">DetectHiddenWindows</a>, On WM_COMMAND := 0x0111 ID_FILE_PAUSE := 65403 <a href="PostMessage.htm">PostMessage</a>, WM_COMMAND, ID_FILE_PAUSE,,, C:\YourScript.ahk ahk_class AutoHotkey</pre> </div> </body> </html>