/AutoHotkey.docset/Contents/Resources/Documents/commands/Suspend.htm

https://gitlab.com/ahkscript/Autohotkey.docset · HTML · 48 lines · 40 code · 8 blank · 0 comment · 0 complexity · 1b4d97d68ca55dcc37ebe9f473cc703f MD5 · raw file

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Suspend</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <link href="../static/theme.css" rel="stylesheet" type="text/css" />
  8. <script src="../static/content.js" type="text/javascript"></script>
  9. </head>
  10. <body>
  11. <h1>Suspend</h1>
  12. <p>Disables or enables all or selected <a href="../Hotkeys.htm">hotkeys</a> and <a href="../Hotstrings.htm">hotstrings</a>.</p>
  13. <pre class="Syntax">Suspend [, Mode]</pre>
  14. <h3>Parameters</h3>
  15. <dl>
  16. <dt>Mode</dt>
  17. <dd><p><strong>On</strong>: Suspends all <a href="../Hotkeys.htm">hotkeys</a> and <a href="../Hotstrings.htm">hotstrings</a> except those explained the Remarks section.</p>
  18. <p><strong>Off</strong>: Re-enables the hotkeys and hotstrings that were disable above.</p>
  19. <p><strong>Toggle</strong> (default): Changes to the opposite of its previous state (On or Off).</p>
  20. <p><strong>Permit</strong>: Does nothing except mark the current subroutine as being exempt from suspension.</p></dd>
  21. </dl>
  22. <h3>Remarks</h3>
  23. <p>Any hotkey/hotstring subroutine whose very first line is Suspend (except <code>Suspend On</code>) will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON. This allows suspension to be turned off via such a hotkey.</p>
  24. <p>The <a href="_InstallKeybdHook.htm">keyboard</a> and/or <a href="_InstallMouseHook.htm">mouse</a> hooks will be installed or removed if justified by the changes made by this command.</p>
  25. <p>To disable selected hotkeys or hotstrings automatically based on the type of window that is present, use <a href="_IfWinActive.htm">#IfWinActive/Exist</a>.</p>
  26. <p>Suspending a script's hotkeys does not stop the script's already-running <a href="../misc/Threads.htm">threads</a> (if any); use <a href="Pause.htm">Pause</a> to do that.</p>
  27. <p>When a script's hotkeys are suspended, its tray icon changes to the letter S. This can be avoided by freezing the icon, which is done by specifying 1 for the last parameter of the Menu command. For example:</p>
  28. <pre><a href="Menu.htm">Menu</a>, Tray, Icon, C:\My Icon.ico, , 1</pre>
  29. <p>The built-in variable A_IsSuspended contains 1 if the script is suspended and 0 otherwise.</p>
  30. <h3>Related</h3>
  31. <p><a href="_IfWinActive.htm">#IfWinActive/Exist</a>, <a href="Pause.htm">Pause</a>, <a href="Menu.htm">Menu</a>, <a href="ExitApp.htm">ExitApp</a></p>
  32. <h3>Example</h3>
  33. <pre class="NoIndent">^!s::Suspend <em>; Assign the toggle-suspend function to a hotkey.</em></pre>
  34. <pre id="PostMessage" class="NoIndent"><em>; Send a Suspend command to another script.</em>
  35. <a href="DetectHiddenWindows.htm">DetectHiddenWindows</a>, On
  36. WM_COMMAND := 0x111
  37. ID_FILE_SUSPEND := 65404
  38. <a href="PostMessage.htm">PostMessage</a>, WM_COMMAND, ID_FILE_SUSPEND,,, C:\YourScript.ahk ahk_class AutoHotkey</pre>
  39. </body>
  40. </html>