Files

19112 lines
1.6 MiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/" />
<title>AHK_X11 Help File</title>
<meta name="DC.title" content="AutoHotkey Help File" />
<meta name="DC.language" content="en" />
<meta name="DC.creator" content="Unknown" />
<meta name="DC.identifier" content="f41b7530-06f3-4a5c-839a-895de15c625f" />
<link href="files/calibreHtmlOutBasicCss.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="calibreMeta">
<div class="calibreMetaTitle">
<h1>
AHK_X11 Help File
</h1>
</div>
<div>
AHK_X11 is AutoHotkey for LINUX.<br>
These docs are NOT FOR WINDOWS.<br>
Windows users please go <a href="https://www.autohotkey.com/docs/AutoHotkey.htm">here</a>.
</div>
<aside class="legend">
<strong style="float:left;margin-right:4px;">Legend:</strong>
<div class="x11"> Green, italic: AHK_X11 only</div>
<div class="rm">Grey, strikethrough: Removed because it makes no sense here</div>
<div class="tbd">Red, strikethrough: Not yet supported, but should be. This is TODO.</div>
</aside>
</div>
<div class="main">
<div class="calibreTocIndex">
<h2>Table of contents </h2>
<div>
<noscript>JavaScript disabled. *With* JS, the navigation will auto scroll.</noscript>
<ul>
<li>
<a href="#AutoHotkey.htm">AutoHotkey</a>
</li>
<li>
<a href="#TutorialHelp.htm">Tutorial (quick start)</a>
</li>
<li>
<a href="#FAQHelp.htm">FAQ (Frequently Asked Questions)</a>
</li>
<li>
<a href="#Hotkeys.htm">Hotkeys</a>
</li>
<li>
<a href="#Hotstrings.htm">Hotstrings &amp; auto-replace</a>
</li>
<li>
<a href="#KeyList.htm">Key List (Keyboard, Mouse, Joystick)</a>
</li>
<li>
<a href="#Scripts.htm">Scripts</a>
</li>
<li>
<a href="#Variables.htm">Variables</a>
</li>
<li>
<a href="#LastFoundWindow.htm">The "Last Found" Window</a>
</li>
<li>
<a href="#commands.htm">Alphabetical List of Commands</a>
</li>
<li>
<a href="#ChangeLogHelp.htm">Recent Changes</a>
</li>
<li>
<a href="#">Environment Management</a>
<ul>
<li>
<a class="tbd" href="#ClipWait.htm">ClipWait</a>
</li>
</ul>
</li>
<li>
<a href="#">File, Directory, and Disk Management</a>
<ul>
<li>
<a class="tbd" href="#Drive.htm">Drive</a>
</li>
<li>
<a class="tbd" href="#DriveGet.htm">DriveGet</a>
</li>
<li>
<a class="tbd" href="#DriveSpaceFree.htm">DriveSpaceFree</a>
</li>
<li>
<a href="#FileAppend.htm">FileAppend</a>
</li>
<li>
<a href="#FileCopy.htm">FileCopy</a>
</li>
<li>
<a class="tbd" href="#FileCopyDir.htm">FileCopyDir</a>
</li>
<li>
<a href="#FileCreateDir.htm">FileCreateDir</a>
</li>
<li>
<a href="#FileCreateShortcut.htm">FileCreateShortcut</a>
</li>
<li>
<a href="#FileDelete.htm">FileDelete</a>
</li>
<li>
<a href="#FileGetAttrib.htm">FileGetAttrib</a>
</li>
<li>
<a class="tbd" href="#FileGetShortcut.htm">FileGetShortcut</a>
</li>
<li>
<a class="tbd" href="#FileGetSize.htm">FileGetSize</a>
</li>
<li>
<a href="#FileGetTime.htm">FileGetTime</a>
</li>
<li>
<a class="tbd" href="#FileGetVersion.htm">FileGetVersion</a>
</li>
<li>
<a class="tbd" href="#FileInstall.htm">FileInstall</a>
</li>
<li>
<a class="tbd" href="#FileMove.htm">FileMove</a>
</li>
<li>
<a class="tbd" href="#FileMoveDir.htm">FileMoveDir</a>
</li>
<li>
<a href="#FileReadLine.htm">FileReadLine</a>
</li>
<li class="x11">
<a href="#FileRead.htm">FileRead</a>
</li>
<li>
<a class="tbd" href="#FileRecycle.htm">FileRecycle</a>
</li>
<li>
<a class="tbd" href="#FileRecycleEmpty.htm">FileRecycleEmpty</a>
</li>
<li>
<a class="tbd" href="#FileRemoveDir.htm">FileRemoveDir</a>
</li>
<li>
<a href="#FileSelectFile.htm">FileSelectFile</a>
</li>
<li>
<a href="#FileSelectFolder.htm">FileSelectFolder</a>
</li>
<li>
<a href="#FileSetAttrib.htm">FileSetAttrib</a>
</li>
<li>
<a href="#FileSetTime.htm">FileSetTime</a>
</li>
<li>
<a href="#IfExist.htm">IfExist/IfNotExist</a>
</li>
<li>
<a href="#IniDelete.htm">IniDelete</a>
</li>
<li>
<a href="#IniRead.htm">IniRead</a>
</li>
<li>
<a href="#IniWrite.htm">IniWrite</a>
</li>
<li>
<a href="#LoopFile.htm">Loop (files &amp; folders)</a>
</li>
<li>
<a href="#LoopReadFile.htm">Loop (read file contents)</a>
</li>
<li>
<a href="#SetWorkingDir.htm">SetWorkingDir</a>
</li>
<li>
<a class="tbd" href="#SplitPath.htm">SplitPath</a>
</li>
</ul>
</li>
<li>
<a href="#">Flow of Control</a>
<ul>
<li>
<a href="#h_Include.htm">#Include/#IncludeAgain</a>
</li>
<li>
<a href="#Block.htm">Block</a>
</li>
<li>
<a href="#Break.htm">Break</a>
</li>
<li>
<a href="#Continue.htm">Continue</a>
</li>
<li>
<a href="#Else.htm">Else</a>
</li>
<li>
<a href="#Exit.htm">Exit</a>
</li>
<li>
<a href="#ExitApp.htm">ExitApp</a>
</li>
<li>
<a href="#Gosub.htm">Gosub</a>
</li>
<li>
<a href="#Goto.htm">Goto</a>
</li>
<li>
<a href="#Loop.htm">Loop</a>
</li>
<li>
<a href="#LoopFile.htm">Loop (files &amp; folders)</a>
</li>
<li>
<a href="#LoopParse.htm">Loop (parse a string)</a>
</li>
<li>
<a href="#LoopReadFile.htm">Loop (read file contents)</a>
</li>
<li class="rm">
<a href="#LoopReg.htm">Loop (registry)</a>
</li>
<li>
<a class="tbd" href="#OnExit.htm">OnExit</a>
</li>
<li>
<a href="#Pause.htm">Pause</a>
</li>
<li>
<a href="#Return.htm">Return</a>
</li>
<li>
<a class="tbd" href="#SetBatchLines.htm">SetBatchLines</a>
</li>
<li>
<a href="#SetTimer.htm">SetTimer</a>
</li>
<li>
<a href="#Sleep.htm">Sleep</a>
</li>
<li>
<a href="#Suspend.htm">Suspend</a>
</li>
</ul>
</li>
<li>
<a href="#">GUI, MsgBox, InputBox &amp; Other Dialogs</a>
<ul>
<li>
<a href="#FileSelectFile.htm">FileSelectFile</a>
</li>
<li>
<a href="#FileSelectFolder.htm">FileSelectFolder</a>
</li>
<li>
<a href="#Gui.htm">Gui</a>
</li>
<li>
<a href="#GuiControl.htm">GuiControl</a>
</li>
<li>
<a class="tbd" href="#GuiControlGet.htm">GuiControlGet</a>
</li>
<li>
<a href="#IfMsgBox.htm">IfMsgBox</a>
</li>
<li>
<a class="tbd" href="#InputBox.htm">InputBox</a>
</li>
<li>
<a href="#MsgBox.htm">MsgBox</a>
</li>
<li>
<a class="tbd" href="#Progress.htm">Progress</a>
</li>
<li>
<a class="tbd" href="#Progress.htm">SplashImage</a>
</li>
<li>
<a class="tbd" href="#SplashTextOn.htm">SplashTextOn/SplashTextOff</a>
</li>
<li>
<a href="#ToolTip.htm">ToolTip</a>
</li>
<li>
<a class="tbd" href="#TrayTip.htm">TrayTip</a>
</li>
</ul>
</li>
<li>
<a href="#">Keyboard Control</a>
<ul>
<li>
<a href="#Hotkeys.htm">Hotkeys</a>
<ul>
<li>
<a class="tbd" href="#h_HotkeyInterval.htm">#HotkeyInterval</a>
</li>
<li>
<a class="tbd" href="#h_HotkeyModifierTimeout.htm">#HotkeyModifierTimeout</a>
</li>
<li>
<a href="#h_Hotstring.htm">#Hotstring</a>
</li>
<li>
<a class="tbd" href="#h_MaxHotkeysPerInterval.htm">#MaxHotkeysPerInterval</a>
</li>
<li>
<a class="tbd" href="#h_MaxThreads.htm">#MaxThreads</a>
</li>
<li>
<a class="tbd" href="#h_MaxThreadsBuffer.htm">#MaxThreadsBuffer</a>
</li>
<li>
<a class="tbd" href="#h_MaxThreadsPerHotkey.htm">#MaxThreadsPerHotkey</a>
</li>
<li>
<a href="#Hotkey.htm">Hotkey</a>
</li>
<li>
<a class="tbd" href="#ListHotkeys.htm">ListHotkeys</a>
</li>
<li>
<a href="#Pause.htm">Pause</a>
</li>
<li>
<a href="#Reload.htm">Reload</a>
</li>
<li>
<a href="#Suspend.htm">Suspend</a>
</li>
</ul>
</li>
<li>
<a class="tbd" href="#BlockInput.htm">BlockInput</a>
</li>
<li>
<a href="#ControlSend.htm">ControlSend/ControlSendRaw</a>
</li>
<li>
<a href="#GetKeyState.htm">GetKeyState</a>
</li>
<li>
<a href="#KeyList.htm">Key List (Keyboard, Mouse, Joystick)</a>
</li>
<li>
<a class="tbd" href="#KeyHistory.htm">KeyHistory</a>
</li>
<li>
<a href="#KeyWait.htm">KeyWait</a>
</li>
<li>
<a href="#Input.htm">Input</a>
</li>
<li>
<a href="#Send.htm">Send/SendRaw</a>
</li>
<li>
<a class="tbd" href="#SetKeyDelay.htm">SetKeyDelay</a>
</li>
<li>
<a class="tbd" href="#SetNumScrollCapsLockState.htm">SetNumScrollCapsLockState</a>
</li>
<li>
<a class="tbd" href="#SetStoreCapslockMode.htm">SetStoreCapslockMode</a>
</li>
</ul>
</li>
<li>
<a href="#">Math Commands</a>
<ul>
<li>
<a href="#EnvAdd.htm">EnvAdd (+=, ++)</a>
</li>
<li>
<a href="#EnvDiv.htm">EnvDiv (/=)</a>
</li>
<li>
<a href="#EnvMult.htm">EnvMult (*=)</a>
</li>
<li>
<a href="#EnvSub.htm">EnvSub (-=, --)</a>
</li>
<li>
<a href="#IfEqual.htm">If/IfEqual/IfLess/IfGreater</a>
</li>
<li>
<a href="#IfBetween.htm">If var [not] between Low and High</a>
</li>
<li>
<a href="#IfIs.htm">If var is [not] type</a>
</li>
<li>
<a class="tbd" href="#Random.htm">Random</a>
</li>
<li>
<a class="tbd" href="#SetFormat.htm">SetFormat</a>
</li>
<li>
<a class="tbd" href="#Transform.htm">Transform</a>
</li>
</ul>
</li>
<li>
<a href="#">Misc. Commands</a>
<ul>
<li>
<a class="tbd" href="#h_NoTrayIcon.htm">#NoTrayIcon</a>
</li>
<li>
<a href="#h_SingleInstance.htm">#SingleInstance</a>
</li>
<li>
<a class="tbd" href="#AutoTrim.htm">AutoTrim</a>
</li>
<li>
<a class="tbd" href="#BlockInput.htm">BlockInput</a>
</li>
<li>
<a href="#CoordMode.htm">CoordMode</a>
</li>
<li>
<a class="tbd" href="#ClipWait.htm">ClipWait</a>
</li>
<li>
<a href="#Edit.htm">Edit</a>
</li>
<li>
<a class="tbd" href="#ListLines.htm">ListLines</a>
</li>
<li>
<a class="tbd" href="#ListVars.htm">ListVars</a>
</li>
<li class="x11">
<a href="#EnvGet.htm">EnvGet</a>
</li>
<li>
<a href="#Menu.htm">Menu</a>
</li>
<li>
<a href="#PixelGetColor.htm">PixelGetColor</a>
</li>
<li>
<a href="#PixelSearch.htm">PixelSearch</a>
</li>
<li>
<a href="#Reload.htm">Reload</a>
</li>
<li>
<a class="tbd" href="#SetBatchLines.htm">SetBatchLines</a>
</li>
<li>
<a href="#SetEnv.htm">SetEnv (var = value)</a>
</li>
<li>
<a href="#SetTimer.htm">SetTimer</a>
</li>
<li>
<a class="tbd" href="#SysGet.htm">SysGet</a>
</li>
<li>
<a class="tbd" href="#Thread.htm">Thread</a>
</li>
<li>
<a class="tbd" href="#Transform.htm">Transform</a>
</li>
<li>
<a href="#URLDownloadToFile.htm">URLDownloadToFile</a>
</li>
</ul>
</li>
<li>
<a href="#">Mouse Control</a>
<ul>
<li>
<a href="#ControlClick.htm">ControlClick</a>
</li>
<li>
<a href="#MouseClick.htm">MouseClick</a>
</li>
<li>
<a class="tbd" href="#MouseClickDrag.htm">MouseClickDrag</a>
</li>
<li>
<a href="#MouseGetPos.htm">MouseGetPos</a>
</li>
<li>
<a href="#MouseMove.htm">MouseMove</a>
</li>
<li>
<a class="tbd" href="#SetDefaultMouseSpeed.htm">SetDefaultMouseSpeed</a>
</li>
<li>
<a class="tbd" href="#SetMouseDelay.htm">SetMouseDelay</a>
</li>
</ul>
</li>
<li>
<a href="#">Process Management</a>
<ul>
<li>
<a href="#Exit.htm">Exit</a>
</li>
<li>
<a href="#ExitApp.htm">ExitApp</a>
</li>
<li>
<a class="tbd" href="#OnExit.htm">OnExit</a>
</li>
<li>
<a class="tbd" href="#Process.htm">Process</a>
</li>
<li>
<a href="#Run.htm">Run/RunWait</a>
</li>
<li>
<a class="tbd" href="#RunAs.htm">RunAs</a>
</li>
<li>
<a class="tbd" href="#Shutdown.htm">Shutdown</a>
</li>
<li>
<a href="#Sleep.htm">Sleep</a>
</li>
</ul>
</li>
<li>
<a href="#">Sound Commands</a>
<ul>
<li>
<a class="tbd" href="#SoundGet.htm">SoundGet</a>
</li>
<li>
<a class="tbd" href="#SoundGetWaveVolume.htm">SoundGetWaveVolume</a>
</li>
<li>
<a class="tbd" href="#SoundPlay.htm">SoundPlay</a>
</li>
<li>
<a class="tbd" href="#SoundSet.htm">SoundSet</a>
</li>
<li>
<a class="tbd" href="#SoundSetWaveVolume.htm">SoundSetWaveVolume</a>
</li>
</ul>
</li>
<li>
<a href="#">String Management</a>
<ul>
<li>
<a class="tbd" href="#FormatTime.htm">FormatTime</a>
</li>
<li>
<a href="#IfEqual.htm">If/IfEqual/IfLess/IfGreater</a>
</li>
<li>
<a href="#IfInString.htm">IfInString/IfNotInString</a>
</li>
<li>
<a href="#IfIn.htm">If var [not] in/contains MatchList</a>
</li>
<li>
<a class="tbd" href="#IfIs.htm">If var is [not] type</a>
</li>
<li>
<a href="#LoopParse.htm">Loop (parse a string)</a>
</li>
<li>
<a href="#SetEnv.htm">SetEnv (var = value)</a>
</li>
<li>
<a class="tbd" href="#SetFormat.htm">SetFormat</a>
</li>
<li>
<a class="tbd" href="#Sort.htm">Sort</a>
</li>
<li>
<a class="tbd" href="#StringCaseSense.htm">StringCaseSense</a>
</li>
<li>
<a href="#StringGetPos.htm">StringGetPos</a>
</li>
<li class="x11">
<a href="#RegExGetPos.htm">RegExGetPos</a>
</li>
<li>
<a href="#StringLeft.htm">StringLeft/StringRight</a>
</li>
<li>
<a href="#StringLen.htm">StringLen</a>
</li>
<li>
<a href="#StringLower.htm">StringLower/StringUpper</a>
</li>
<li>
<a href="#StringMid.htm">StringMid</a>
</li>
<li>
<a href="#StringReplace.htm">StringReplace</a>
</li>
<li class="x11">
<a href="#RegExReplace.htm">RegExReplace</a>
</li>
<li>
<a href="#StringSplit.htm">StringSplit</a>
</li>
<li>
<a class="tbd" href="#StringTrimLeft.htm">StringTrimLeft/StringTrimRight</a>
</li>
</ul>
</li>
<li>
<a href="#">Window Management</a>
<ul>
<li>
<a href="#">Controls</a>
<ul>
<li>
<a class="tbd" href="#Control.htm">Control</a>
</li>
<li>
<a href="#ControlClick.htm">ControlClick</a>
</li>
<li>
<a class="tbd" href="#ControlFocus.htm">ControlFocus</a>
</li>
<li>
<a class="tbd" href="#ControlGet.htm">ControlGet</a>
</li>
<li>
<a class="tbd" href="#ControlGetFocus.htm">ControlGetFocus</a>
</li>
<li>
<a href="#ControlGetPos.htm">ControlGetPos</a>
</li>
<li>
<a href="#ControlGetText.htm">ControlGetText</a>
</li>
<li>
<a class="tbd" href="#ControlMove.htm">ControlMove</a>
</li>
<li>
<a href="#ControlSend.htm">ControlSend/ControlSendRaw</a>
</li>
<li>
<a href="#ControlSetText.htm">ControlSetText</a>
</li>
<li>
<a href="#Menu.htm">Menu</a>
</li>
<li>
<a class="tbd" href="#SetControlDelay.htm">SetControlDelay</a>
</li>
<li>
<a class="tbd" href="#WinMenuSelectItem.htm">WinMenuSelectItem</a>
</li>
</ul>
</li>
<li>
<a href="#">Window Groups</a>
<ul>
<li>
<a class="tbd" href="#GroupActivate.htm">GroupActivate</a>
</li>
<li>
<a class="tbd" href="#GroupAdd.htm">GroupAdd</a>
</li>
<li>
<a class="tbd" href="#GroupClose.htm">GroupClose</a>
</li>
<li>
<a class="tbd" href="#GroupDeactivate.htm">GroupDeactivate</a>
</li>
</ul>
</li>
<li>
<a class="tbd" href="#h_WinActivateForce.htm">#WinActivateForce</a>
</li>
<li>
<a class="tbd" href="#DetectHiddenText.htm">DetectHiddenText</a>
</li>
<li>
<a href="#DetectHiddenWindows.htm">DetectHiddenWindows</a>
</li>
<li>
<a href="#IfWinActive.htm">IfWinActive/IfWinNotActive</a>
</li>
<li>
<a href="#IfWinExist.htm">IfWinExist/IfWinNotExist</a>
</li>
<li>
<a class="tbd" href="#SetTitleMatchMode.htm">SetTitleMatchMode</a>
</li>
<li>
<a class="tbd" href="#SetWinDelay.htm">SetWinDelay</a>
</li>
<li>
<a class="tbd" href="#StatusBarGetText.htm">StatusBarGetText</a>
</li>
<li>
<a class="tbd" href="#StatusBarWait.htm">StatusBarWait</a>
</li>
<li>
<a href="#WinActivate.htm">WinActivate</a>
</li>
<li>
<a class="tbd" href="#WinActivateBottom.htm">WinActivateBottom</a>
</li>
<li>
<a href="#WinClose.htm">WinClose</a>
</li>
<li>
<a href="#WinGet.htm">WinGet</a>
</li>
<li>
<a class="tbd" href="#WinGetActiveStats.htm">WinGetActiveStats</a>
</li>
<li>
<a class="tbd" href="#WinGetActiveTitle.htm">WinGetActiveTitle</a>
</li>
<li>
<a href="#WinGetClass.htm">WinGetClass</a>
</li>
<li>
<a href="#WinGetPos.htm">WinGetPos</a>
</li>
<li>
<a href="#WinGetText.htm">WinGetText</a>
</li>
<li>
<a href="#WinGetTitle.htm">WinGetTitle</a>
</li>
<li>
<a class="tbd" href="#WinHide.htm">WinHide</a>
</li>
<li>
<a href="#WinKill.htm">WinKill</a>
</li>
<li>
<a href="#WinMaximize.htm">WinMaximize</a>
</li>
<li>
<a href="#WinMinimize.htm">WinMinimize</a>
</li>
<li>
<a class="tbd" href="#WinMinimizeAll.htm">WinMinimizeAll/WinMinimizeAllUndo</a>
</li>
<li>
<a href="#WinMove.htm">WinMove</a>
</li>
<li>
<a href="#WinRestore.htm">WinRestore</a>
</li>
<li>
<a href="#WinSet.htm">WinSet</a>
</li>
<li>
<a class="tbd" href="#WinSetTitle.htm">WinSetTitle</a>
</li>
<li>
<a class="tbd" href="#WinShow.htm">WinShow</a>
</li>
<li>
<a class="tbd" href="#WinWait.htm">WinWait</a>
</li>
<li>
<a class="tbd" href="#WinWaitActive.htm">WinWaitActive/WinWaitNotActive</a>
</li>
<li>
<a class="tbd" href="#WinWaitClose.htm">WinWaitClose</a>
</li>
</ul>
</li>
<li>
<a href="#">#Directives</a>
<ul>
<li>
<a class="tbd" href="#h_CommentFlag.htm">#CommentFlag</a>
</li>
<li>
<a class="tbd" href="#h_ErrorStdOut.htm">#ErrorStdOut</a>
</li>
<li>
<a class="tbd" href="#h_EscapeChar.htm">#EscapeChar</a>
</li>
<li>
<a class="tbd" href="#h_HotkeyInterval.htm">#HotkeyInterval</a>
</li>
<li>
<a class="tbd" href="#h_HotkeyModifierTimeout.htm">#HotkeyModifierTimeout</a>
</li>
<li>
<a href="#h_Hotstring.htm">#Hotstring</a>
</li>
<li>
<a href="#h_Include.htm">#Include/#IncludeAgain</a>
</li>
<li>
<a class="tbd" href="#h_MaxHotkeysPerInterval.htm">#MaxHotkeysPerInterval</a>
</li>
<li>
<a class="tbd" href="#h_MaxMem.htm">#MaxMem</a>
</li>
<li>
<a class="tbd" href="#h_MaxThreads.htm">#MaxThreads</a>
</li>
<li>
<a class="tbd" href="#h_MaxThreadsBuffer.htm">#MaxThreadsBuffer</a>
</li>
<li>
<a class="tbd" href="#h_MaxThreadsPerHotkey.htm">#MaxThreadsPerHotkey</a>
</li>
<li>
<a class="tbd" href="#h_NoTrayIcon.htm">#NoTrayIcon</a>
</li>
<li>
<a href="#h_Persistent.htm">#Persistent</a>
</li>
<li>
<a href="#h_SingleInstance.htm">#SingleInstance</a>
</li>
<li>
<a href="#h_WinActivateForce.htm">#WinActivateForce</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="calibreMain content">
<div class="calibreMain">
<div class="calibreEbookContent">
<table width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4"><a href="" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><img loading="lazy" border="0" src="./popup.png" class="calibre6" /></a></td>
<td class="calibre4">
<h3 class="calibre7"><a id="AutoHotkey.htm" href="#AutoHotkey.htm">#</a> Version <a href="#ChangeLogHelp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">1.0.24</a></h3>
<h3 class="calibre7"><a href="https://github.com/phil294/AHK_X11" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">https://github.com/phil294/AHK_X11</a></h3>
<p class="calibre8">©2022 <a href="https://waritschlager.de" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Philip Waritschlager</a>
<p class="calibre8">Original Docs (this site): ©2003-2004 Chris Mallett, portions ©<a href="http://www.hiddensoft.com/autoit3/" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoIt Team</a></p>
</td>
</tr>
</tbody>
</table>
<h2 class="calibre9">What is it?</h2>
<ul class="calibre10">
<li class="calibre11">Free &amp; open source (<a href="https://github.com/phil294/AHK_X11/blob/master/LICENSE" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GNU General Public License</a>).</li>
<li class="calibre11">A simple yet powerful hotkey (shortcut key) scripting language, supporting both mouse and keyboard macros (if you're new to scripting, it might be easier than you think; check out the <a href="#TutorialHelp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">quick-start tutorial</a>).</li>
<li class="calibre11">A <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">word recognition engine</a> that expands abbreviations as you type them (auto-replace). </li>
<li class="calibre11">A regular scripting language. The program includes a <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">script compiler</a> that converts a script to an <span class="rm">EXE</span> <span class="x11">executable</span>. <span class="tbd">It also includes AutoScriptWriter, a macro recorder written by Larry Keys.</span><br class="calibre12" />
<li class="calibre11">A keyboard, joystick, and mouse <a href="#Remap.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">remapper</a>.</li>
<li class="x11">AHK_X11 is a complete reimplementation of AutoHotkey for X11-based systems such as most Linux systems. It is still in development as of 2022/08. A lot of work is done but several commands are still missing. You can find installation details below and/or on the GitHub page linked above.</li>
<li class="x11">These docs are based on the <a href="https://www.autohotkey.com/download/1.0/AutoHotkey1024.exe">original AHK docs from December 2004</a>, complemented by annotations (see Legend above - not super accurate though). Black text was not changed and should work (except some code samples). AHK_X11 only aims at implementing the spec from that time. This "Classic AHK" approach means that more modern features such as expressions or functions are not supported.</li>
<li class="x11">In short, this doc file should be accurate and tell you everything you need.</li>
</ul>
<h2 class="calibre9">Who might benefit?</h2>
<ul class="calibre10">
<li class="calibre11">Those wishing to automate repetitive tasks.</li>
<li class="calibre11">Those having an interest in creating hotkeys that: <ul class="calibre13">
<li class="calibre11"><span class="rm"> aren't limited to only those combinations allowed by Windows;</span></li>
<li class="calibre11"> are <a href="#HotkeyFeatures.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> more flexible </a> and capable of greater complexity than those of most other hotkey apps;</li>
<li class="calibre11"><span class="rm"> are more responsive (take effect more quickly) than standard Windows hotkeys.</span></li>
</ul>
</li>
<li class="calibre11">Anyone concerned about, or already suffering from Repetitive Stress Injury (RSI). <span class="tbd">For example, the mouse wheel can be used as an entire substitute for <a href="#HotkeyFeatures.htm__AltTab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Alt-Tab</a></span>.</li>
</ul>
<h2 class="calibre9">More benefits</h2>
<ul class="calibre10">
<li class="calibre11"> Use <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ELSE</a> with every <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IF-type</a> command.</li>
<li class="calibre11">Use <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">blocks</a> (multi-line sections) with IFs and ELSEs (virtually eliminating the need for Goto).</li>
<li class="calibre11">Use <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> and <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">continue</a> inside <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loops</a> (another way to eliminate Goto's).</li>
<li class="calibre11">Use a set of new commands and benefit from enhancements to old ones.</li>
<li class="calibre11">Catch silly errors and typos early (at load-time) rather than later (during runtime) when you may be less prepared to deal with them: Each script is thoroughly checked before it begins running.</li>
<li class="calibre11">Take complete control of your keyboard, joystick, and mouse: <span class="rm">AutoHotkey has far better hotkey support than Windows provides (and is more responsive too).</span> It's also more powerful than most commercially available hotkey applications. For example, <span class="rm">Windows' built-in hotkeys</span>, such as Win-E and Win-R, can be selectively <a href="#Override.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">overridden</a>. Also, <strong class="calibre14">any</strong> two keys <span class="tbd">and/or mouse buttons</span> can be combined to become a hotkey.</li>
<li class="calibre11">Gain a significant boost in <a href="#Performance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">performance</a>.</li>
</ul>
<p class="calibre8"> </p>
<h2 class="calibre9">Acknowledgements</h2>
<p class="calibre8"> A special thanks to Jonathan Bennett, whose generosity in releasing AutoIt2 as free software in 1999 served as an inspiration and time-saver for myself and many others worldwide. In addition, many of AutoHotkey's enhancements to the AutoIt2 command set, as well as the Window Spy and the script compiler, were adapted directly from the AutoIt3 source code. So thanks to Jon and the other AutoIt3 authors for those as well.<br class="calibre12" />
<br class="calibre12" /> Finally, AutoHotkey would not be what it is today without <a href="#Acknowledgements.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">these other individuals</a>.
</p>
<p class="calibre8"> </p>
<p class="calibre8"><img loading="lazy" src="blue_gradient_1024x24.jpg" class="calibre15" /></p>
</div>
</div>
<a href="#AutoHotkey.htm" class="go-to-top">🡡 Back To top</a>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="TutorialHelp.htm" href="#TutorialHelp.htm">#</a>
<div class="calibre16">
<h2 class="calibre9">AutoHotkey Tutorial and Overview </h2>
</div>
<p class="calibre8">This brief introduction will help you start scripting your own macros and hotkeys right away.</p>
<h2 class="calibre18">Tutorial Contents</h2>
<ul class="calibre10">
<li class="style"><a href="#TutorialHelp.htm__Install" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Installation</a></li>
<li class="style"><a href="#TutorialHelp.htm__Create" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Creating a script</a></li>
<li class="style"><a href="#TutorialHelp.htm__Launch" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Launching a program or document</a></li>
<li class="style"><a href="#TutorialHelp.htm__Send" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sending keystrokes &amp; mouse clicks</a></li>
<li class="style"><a href="#TutorialHelp.htm__Activate" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Activating and manipulating windows</a></li>
<li class="style"><a href="#TutorialHelp.htm__Dialogs" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Getting input from the user with MsgBox, InputBox, etc. </a></li>
<li class="style"><a href="#TutorialHelp.htm__Variables" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Using variables and the clipboard</a></li>
<li class="style"><a href="#TutorialHelp.htm__Files" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Manipulating files and folders</a></li>
<li class="style"><a href="#TutorialHelp.htm__Overview" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Overview of other features</a> </li>
</ul>
<p class="style1 x11">
<a id="TutorialHelp.htm__Install" href="#TutorialHelp.htm__Install" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Installation
</p>
<ol class="calibre19 x11">
<li class="calibre11">Download the program from <a href="https://github.com/phil294/ahk_x11/releases/latest/download/ahk_x11.zip">here</a></li>
<li class="calibre11">Extract it</li>
<li class="calibre11">Run it, for example by double clicking. If this does not work, then you also need to mark it as executable. This usually works via right click / file properties.</li>
<li class="calibre11">Now the installer should open. Click install and your setup is complete.</li>
<li class="calibre11">Please be aware that so far, there is *no* auto-update function. New features are being added all the time right now, so you should probably repeat the above steps then and again. The documentation (this very site) will always be up to date.</li>
</ol>
<p class="style1">
<a id="TutorialHelp.htm__Create" href="#TutorialHelp.htm__Create" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Creating a script
</p>
<ol class="calibre19">
<li class="calibre11">Open Windows Explorer and select a directory of your choice.</li>
<li class="calibre11">Pull down the File menu and choose <span class="rm">New &gt;&gt; AutoHotkey Script</span> (or Text Document). </li>
<li class="calibre11">Type a name for the file, ensuring that it ends in <strong class="calibre14">.ahk</strong>. Example: Test.ahk</li>
<li class="calibre11">Right-click the file and choose <span class="rm">Edit Script.</span><span class="x11"> Open with... -> Your text editor of choice (but *don't* set it as default)</span></li>
<li class="calibre11">On a new blank line, type the following:<br class="calibre12" /> #z::Run www.google.com</li>
</ol>
<p class="calibre8">The # means the Windows key <span>("Super key")</span>, so the #z means holding down the Windows key then pressing Z to activate a hotkey. The :: means that the subsequent command should be executed whenever this hotkey is pressed, in this case to go to the Google web site. To try out this script, continue as follows:</p>
<ol class="calibre19">
<li class="calibre11">Save and close the file.</li>
<li class="calibre11">In <span class="rm">Windows</span> Explorer, double-click the script to launch it. A new tray icon appears.</li>
<li class="calibre11"> Press Win+Z. A web page opens in the default browser.</li>
<li class="calibre11">To exit or edit the script, right click its tray icon.</li>
</ol>
<p class="calibre8"> Note: Each script can contain any number of hotkeys (in the absence of hotkeys, a script will perform a series of sequential actions the moment it is launched). In addition, multiple scripts can be running simultaneously, <span class="tbd">each with its own tray icon.</span></p>
<p class="calibre8"> </p>
<p class="style1"><a id="TutorialHelp.htm__Launch" href="#TutorialHelp.htm__Launch" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Launching a program or document</p>
<p class="calibre8">The <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> command is used to launch a program, document, URL, or shortcut, as in the following examples:<br class="calibre12" /> Run, gedit<br class="calibre12" /> Run, %A_Home%/Documents/Address List.doc<br class="calibre12" /> <br class="calibre12" /> Run, www.yahoo.com<br class="calibre12" /> Run, mailto:someone@anywhere.com</p>
<p class="calibre8">A hotkey can be assigned to any of the above examples by including a <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey label</a>. In the first example below, the assigned hotkey is Win+N, while in the second it is Control+Alt+C:<br class="calibre12" /> #n::Run, gedit<br class="calibre12" /> ^!c::Run, calc.exe</p>
<p class="calibre8">The above examples are known as single-line hotkeys because each consists of only one command. To have more than one command executed by a hotkey, put the first line <u class="calibre20">beneath</u> the hotkey definition and make the last line a <em class="calibre21"><a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">return</a></em>. For example:<br class="calibre12" /> #n::<br class="calibre12" /> Run, www.google.com<br class="calibre12" /> Run, gedit<br class="calibre12" /> return</p>
<p class="calibre8">If the program or document to be run is not integrated with the system, specify its full path to get it to launch:<br class="calibre12" /> Run, %A_Home%/bin/program</p>
<p class="calibre8">In the above example, %A_Home% is an <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable</a> maintained by the operating system. By using it rather than something like /home/yourname, the script is made more portable, meaning that it would be more likely to run successfully on another computer with another username.</p>
<p class="calibre8">To have the script wait for the program or document to close before continuing, use <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> instead of Run. In this example, the <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> command will not run until after the user closes Gedit (untested):<br class="calibre12" /> RunWait, gedit<br class="calibre12" /> MsgBox, The user has finished (Gedit has been closed).</p>
<p class="calibre8">This topic continues <a href="#TutorialLaunchHelp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">here</a> with the following advanced information: launching a program in a minimized/maximized/hidden state, specifying a working directory, passing parameters, using system verbs, and discovering a program's exit code.</p>
<p class="calibre8"> </p>
<p class="style1"><a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>Sending keystrokes and mouse clicks</p>
<p class="calibre8">Keystrokes are sent to the active (foremost) window by using the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command. In the following example, Win+S becomes a hotkey to type a signature. Be sure that a window such as an editor or draft e-mail message is active before pressing the hotkey:<br class="calibre12" /> #s::<br class="calibre12" /> Send, Sincerely,{enter}John Smith<br class="calibre12" /> return</p>
<p class="calibre8">In the above example, all characters are sent literally except {enter} (which results in a simulated press of the Enter key). The next example illustrates some of the other commonly used special characters:<br class="calibre12" /> Send, ^c!{tab}pasted:^v</p>
<p class="calibre8">The above example sends a Control+C followed by an Alt+Tab followed by the string "pasted:" followed by a Control+V. See the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command for a complete list of special characters and keys. </p>
<p class="calibre8"><u class="calibre20"><strong class="calibre14">Mouse Clicks</strong></u><strong class="calibre14">:</strong> To send a mouse click to a window it is first necessary to determine the X &amp; Y coordinates where the click should occur. This can be done with <span class="rm">either AutoScriptWriter or</span> <span class="x11">Window Spy, which is included with AutoHotkey</span>. The following steps apply to the Window Spy method:</p>
<ol class="calibre19">
<li class="calibre11">Launch Window Spy from the program's tray-icon menu or the Start Menu.</li>
<li class="calibre11">Activate the window of interest either by clicking its title bar, alt-tabbing, or other means (Window Spy will stay "always on top" by design).</li>
<li class="calibre11">Move the mouse cursor to the desired position in the target window and write down the mouse coordinates displayed by Window Spy (or press Shift-Alt-Tab to activate Window Spy so that the "frozen" coordinates can be copied and pasted).</li>
<li class="calibre11">Use the coordinates discovered above with the <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="">MouseClick</span></a> command as in this example, which clicks the left mouse button:<br class="calibre12" /> MouseClick, left, 112, 223 </li>
</ol>
<p class="calibre8">To move the mouse without clicking, use <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>. To drag the mouse, use <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="tbd">MouseClickDrag</span></a>. </p>
<p class="calibre8"> </p>
<p class="style1"><a id="TutorialHelp.htm__Activate" href="#TutorialHelp.htm__Activate" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Activating and manipulating windows</p>
<p class="calibre8">To activate a window (make it foremost), use <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>. To detect whether a window exists, use <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a> or <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="tbd">WinWait</span></a>. The following example illustrates these commands:</p>
<pre class="calibre22">IfWinExist, Untitled - Notepad
{
WinActivate
}
else
{
Run, Notepad
WinWait, Untitled - Notepad
WinActivate
}</pre>
<p class="calibre8">The above example first searches for any existing window whose title starts with "Untitled - Notepad" (case sensitive). If such a window is found, it is activated. Otherwise, Notepad is launched and the script waits for the Untitled window to appear, at which time it is activated. The above example also utilizes the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">last found window</a> to avoid the need to specify the window's title with each WinActivate.</p>
<p class="calibre8">Some of the other commonly used window commands are:</p>
<ul class="calibre10">
<li class="calibre11"> <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="tbd">WinWaitActive</span></a>: Waits for a window to become active (typically used immediately after a <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> command).</li>
<li class="calibre11"><a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>: Checks if a window is currently active.</li>
<li class="calibre11"><a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a>: Closes a window.</li>
<li class="calibre11"><a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>: Moves or resizes a window.</li>
<li class="calibre11"><a href="#WinMinimize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimize</a>, <a href="#WinMaximize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMaximize</a>, <a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a>: Minimizes, maximizes, or restores a window, respectively. </li>
</ul>
<p class="style1"> </p>
<p class="style1"><a id="TutorialHelp.htm__Dialogs" href="#TutorialHelp.htm__Dialogs" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Getting input from the user with MsgBox, InputBox, etc. </p>
<p class="calibre8">The following example displays a dialog with two buttons (YES and NO):<br class="calibre12" />
<a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, 4, , Would you like to continue?<br class="calibre12" />
<a href="#IfMsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="">IfMsgBox</span></a>, No, return<br class="calibre12" /> ; Otherwise, the user picked yes.<br class="calibre12" /> MsgBox, You pressed YES.
</p>
<p class="calibre8">Use the <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="tbd">InputBox</span></a> command to prompt the user to type a string. Use <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="">FileSelectFile</span></a> or <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="">FileSelectFolder</span></a> to have the user select a file or folder. For more advanced tasks, use the <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> command to create custom data entry forms and user interfaces.</p>
<p class="calibre8"> </p>
<p class="style1"><a id="TutorialHelp.htm__Variables" href="#TutorialHelp.htm__Variables" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Using variables and the clipboard</p>
<p class="calibre8">All variables are global; that is, their contents may be read or altered by any <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">subroutine</a> in the entire script. In addition, there are no data types: all variables contain strings (sequences of characters or digits). Finally, variables do not need to be declared: the program ensures they exist when needed.</p>
<p class="calibre8">To assign a string to a variable, follow these examples:</p>
<pre class="calibre22">MyVar1 = 123
MyVar2 = my string</pre> To compare the contents of a variable to a string, follow these examples:
<pre class="calibre22">if MyVar2 = my string
{
MsgBox MyVar2 contains the string "my string".
}
if MyVar1 &gt;= 100
{
MsgBox MyVar1 contains a number greater than or equal to 100.
}</pre>
<p class="calibre8"> To assign the contents of a variable to a second variable, enclose the first variable's name in percent signs. In the example below, MyVarConcatenated will be assigned the string "123 my string" (without the double quotes): </p>
<pre class="calibre22">MyVarConcatenated = %MyVar1% %MyVar2%</pre>
<p class="calibre8">To compare the contents of a variable with that of another, consider this example: </p>
<pre class="calibre22">MyVar = 200
MyVarLimit = 100
if MyVar &gt; %MyVarLimit%
{
MsgBox The number in MyVar, which is %MyVar%, is beyond the limit of %MyVarLimit%.
}</pre>
<p class="calibre8">By contrast, here are some examples of incorrect variable usage:</p>
<pre class="calibre22">MyVar2 = MyVar1 ; Wrong because it assigns the literal string "MyVar1" to MyVar2.
if MyVar &gt; MyVarLimit ; Wrong because there should be percent signs around MyVarLimit.
if %MyVar% &gt; %MyVarLimit% ; Wrong because MyVar should not have percent signs.</pre>
<p class="calibre8">As seen in the examples above, the rule of thumb is to enclose a variable in percent signs whenever it is used on the right side of an assignment or comparison.</p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20"><strong class="calibre14">Math</strong></u>:AutoHotkey is currently limited to one math operation per line. For example, an assignment that might be written as "x = y + 5" in another language would need to be done in two steps:<br class="calibre12" /> x = %y%<br class="calibre12" /> x += 5 </p>
<p class="calibre8">In the example above, the += symbol means "increase the variable on the left by the number at the right". In a similar way, subtraction, multiplication, and division are accomplished via -=, *=, and /=, respectively. Advanced math operations such as logarithms, trigonometry, raising a number to a power, and bitwise manipulations are possible via the <a href="#Transform.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="tbd">Transform</span></a> command.</p>
<p class="calibre8"><u class="calibre20"><strong class="calibre14">Clipboard</strong></u>: The variable named Clipboard is a special variable containing the current text on the Windows clipboard. It can be used just like any other variable. For example, the following line replaces the current contents of the clipboard with new text:</p>
<p class="calibre8"> clipboard = A line of text.`nA second line of text.`n</p>
<p class="calibre8">In the above line, `n (accent followed by the letter "n") is a special string used to indicate a special character: linefeed. This character starts a new line of text as though the user had pressed Enter.</p>
<p class="calibre8">To append text to the clipboard (or any other variable), follow this example:<br class="calibre12" /> clipboard = %clipboard% And here is the text to append. </p>
<p class="calibre8">See the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard</a> and <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variables</a> sections for more details. </p>
<p class="calibre8"> </p>
<p class="style1"><a id="TutorialHelp.htm__Files" href="#TutorialHelp.htm__Files" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Manipulating files and folders</p>
<p class="calibre8">To append text to a file, consider the following example. Note that it uses `n (linefeed) to start a new line of text afterward:<br class="calibre12" />
<a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a>, A line of text to append.`n, C:\My Documents\My Text File.txt
</p>
<p class="calibre8">Some of the other commonly used file and folder commands are:</p>
<ul class="calibre10">
<li class="calibre11"><span class=""><a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-reading Loop</a>: Retrieve the lines in a text file, one by one.</span></li>
<li class="calibre11"><span class=""><a href="#IfExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfExist</a>: Determine whether a file or folder exists.</span></li>
<li class="calibre11"><span class=""><a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File Loop</a>: Retrieve the files and folders contained in a folder, one at a time. </span></li>
<li class="calibre11"><a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>: Copy one or more files. <span class="tbd">Use <a href="#FileCopyDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopyDir</a> to copy an entire folder. </span></li>
<li class="calibre11"><span class="tbd"><a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>: Move or rename one or more files. Use <a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a> to move an entire folder. </span></li>
<li class="calibre11"><span class=""><a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a>: Delete one or more files. Use <a href="#FileRemoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRemoveDir</a> to delete an entire folder. </span></li>
<li class="calibre11"><span class="tbd"><a href="#FileRecycle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycle</a>: Send one or more files (or an entire folder) to the recycle bin.</span></li>
<li class="calibre11"><span class=""><a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a> and <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>: Display a dialog for the user to pick a file or folder.</span></li>
<li class="calibre11"><span class=""><a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a> and <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a>: Change the attributes or timestamp of one or more files.</span></li>
<li class="calibre11"><span class=""><a href="#IniRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniRead</a>, <a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a>, and <a href="#IniDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniDelete</a>: Create, access, and maintain standard-format INI files.</span></li>
<li class="calibre11"><span class="rm"><a href="#RegRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegRead</a>, <a href="#RegWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegWrite</a>, <a href="#RegDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegDelete</a>, and <a href="#LoopReg.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Registry Loop</a>: Work with the Windows registry. </span></li>
</ul>
<p class="style1"> </p>
<p class="style1"><a id="TutorialHelp.htm__Overview" href="#TutorialHelp.htm__Overview" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Overview of other features</p>
<p class="calibre8">(this section is still under development, see the <a href="#commands.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">command list</a> for an overview of every command</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FAQHelp.htm" href="#FAQHelp.htm">#</a>
<div class="calibre16">
<h2 class="calibre9">AutoHotkey Frequently Asked Questions (FAQ)</h2>
</div>
<h3 class="calibre7">When are quotation marks used with commands and their parameters?</h3>
<p class="calibre8">Single quotes (') and double quotes (") have no special meaning within the AutoHotkey language; they are always treated literally as if they were normal characters. However, when AutoHotkey launches a program or document, the operating system usually requires double quotes around any command-line parameter that contains spaces, such as in this example: Run, gedit "/home/Documents/Address List.txt"</p>
<h3 class="calibre7"> Why is the <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> command unable to launch my game or program?</h3>
<p class="calibre8">Some programs need to be started in their own directories (when in doubt, it is usually best to do so). Example:<br class="calibre12" /> Run, /opt/app/bin, /opt/app</p>
<h3 class="calibre7"><br class="calibre12" /> I'm having trouble getting my mouse buttons working as hotkeys. Any advice?</h3>
<p class="calibre8">The left and right mouse buttons should be assignable normally (for example, "#LButton::" is the Win+LeftButton hotkey). Similarly, the middle button and the turning of the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse wheel</a> should be assignable normally except on mice whose drivers directly control those buttons.</p>
<p class="calibre8"><span class="tbd"> The fourth button (XButton1) and the fifth button (XButton2) might be assignable if your mouse driver allows their clicks to be <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">seen</a> by the system.</span> If they cannot be seen -- or if your mouse has more than five buttons -- you can try configuring the software that came with the mouse (sometimes accessible in the Control Panel or Start Menu) to send a keystroke whenever you press one of these buttons. Such a keystroke can then be defined as a hotkey in a script. For example, if you configure the fourth button to send Control+F12, you can then indirectly configure that button as a hotkey by using <em class="calibre21">^F12::</em> in the script.</p>
<p class="calibre8">If you have a five-button mouse whose fourth and fifth buttons cannot be <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">seen</a>, you can try changing your mouse driver to the default driver included with the OS. This assumes there is such a driver for your particular mouse and that you can live without the features provided by your mouse's custom software.</p>
<h3 class="calibre7"><br class="calibre12" /> How can symbols and punctuation marks be defined as hotkeys?</h3>
<p class="calibre8">Symbols that don't require the shift key to be held down can be defined normally (except for semicolon, <span class="tbd">which should be defined as `;::</span>). For example, this line would make accent (`) become a hotkey: `::MsgBox, Accent was pressed.</p>
<p class="calibre8">However, symbols that require the shift key to be held down (such as @ and ?) can be defined as hotkeys by including the SHIFT modifier in the definition of the symbol's unshifted key. For example, this line would make Control-Asterisk become a hotkey: ^+8::MsgBox, Ctrl-* was pressed.</p>
<h3 class="calibre7"><br class="calibre12" /> How can a combination of modifier keys be made a hotkey?</h3>
<p class="calibre8">The modifier symbols must always apply to a named key. For example, to define Ctrl+Alt+Win as a hotkey, use ^!LWin or ^!RWin rather than ^!#. To define the spacebar, use ^Space rather than "^ ". Note that the modifier keys must be pressed before the named key, so in the first example Ctrl+Alt must be held down prior to pressing LWin or RWin.</p>
<h3 class="calibre7"><br class="calibre12" /> How can keys or mouse buttons be remapped so that they become different keys?</h3>
<p class="calibre8">This is described on the <a href="#Remap.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">remapping</a> page.</p>
<h3 class="calibre7"><br class="calibre12" /> How can a hotkey be made exclusive to certain program(s)? In other words, I want a certain key to act as it normally does except when a specific window is active.</h3>
<p class="calibre8">In the following example, NumpadEnter is made to perform normally except when a window titled "CAD Editor" is active. Note the use of the $ prefix in "$NumpadEnter", which is required to let the hotkey "send itself":</p>
<pre class="calibre22">$NumpadEnter::
IfWinNotActive, CAD Editor
{
Send, {NumpadEnter}
return
}
; Otherwise, the desired application is active, so do a custom action:
Send, abc
return
</pre>
<p class="calibre8">This next example is more pure than the above, but it will only work if the "CAD Editor" application is designed to ignore the NumpadEnter key itself. The tilde prefix (~) makes NumpadEnter into a non-suppressed hotkey, meaning that the NumpadEnter keystroke itself is always sent to the active window, the only difference being that it triggers a hotkey action:</p>
<pre class="calibre22">~NumpadEnter::
IfWinNotActive, CAD Editor
return
Send, abc
return</pre>
<h3 class="calibre7"><br class="calibre12" />
<br class="calibre12" /> How can a repeating action be stopped without exiting the script?
</h3>
<p class="calibre8">To stop an action that is repeating inside a <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, consider the following example hotkey, which both starts and stops its own repeating action. In other words, pressing the hotkey once will start the Loop. Pressing the same hotkey again will stop it.</p>
<pre class="calibre22"><span class="tbd">#MaxThreadsPerHotkey</span> 3
#z::
#MaxThreadsPerHotkey 1
if KeepWinZRunning = y ; This means an underlying <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> is already running the loop below.
{
KeepWinZRunning = ; Make it blank to signal that thread's loop to stop.
return ; End this thread so that the one underneath will resume and see the change.
}
; Otherwise:
KeepWinZRunning = y
Loop,
{
ToolTip, Press Win-Z again to stop this from flashing.
Sleep, 1000
ToolTip
if KeepWinZRunning = ; The user signaled the loop to stop by pressing Win-Z again.
break ; Break out of this loop.
Sleep, 1000
}
return
</pre>
<p class="calibre8">Note: To pause or resume the entire script at the press of a key, assign a hotkey to the <a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Pause</a> command as in this example:<br class="calibre12" /> ^!p::Pause ; Press Ctrl+Alt+P to pause. Press it again to resume.</p>
<h3 class="calibre7"><br class="calibre12" />How can a prefix key be made to perform its native function rather than doing nothing?</h3>
<div class="tbd">
<p class="calibre8">Consider the following example, which makes Numpad0 into a prefix key:<br class="calibre12" /> Numpad0 &amp; Numpad1::MsgBox, You pressed Numpad1 while holding down Numpad0.</p>
<p class="calibre8">Now, to make Numpad0 send a real Numpad0 keystroke whenever it wasn't used to launch a hotkey such as the above, add the following hotkey. The $ prefix is needed to prevent a warning dialog about an infinite loop (since the hotkey "sends itself"). In addition, the below action occurs at the time the key is <strong class="calibre14">released:</strong><br class="calibre12" /> $Numpad0::Send, {Numpad0}</p>
</div>
<h3 class="calibre7"><br class="calibre12" /> How to avoid trouble with ALT hotkeys that use the Send command? </h3>
<p class="calibre8">The trouble is caused by the fact that the ALT key tends to activate the menu bar of the active window. The following example shows a workaround that may fix the problem in some cases: !a::Send, {AltUp}{Alt}Text To Send. </p>
<h3 class="calibre7"><br class="calibre12" /> How can context sensitive help for AutoHotkey commands be used in any editor?</h3>
<p class="calibre8">Rajat created <a href="#ContextSensitiveHelp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">this script</a>.</p>
<h3 class="calibre7"><br class="calibre12" /> My keypad has a special 000 key. Is it possible to turn it into a hotkey? </h3>
<p class="calibre8"><span class="tbd">You can, but only if you're running Windows NT, 2000, XP, or beyond. This <a href="#Numpad000.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">example script</a> makes the 000 key into an equals key. You can change the action by replacing the "Send, =" line with line(s) of your choice. </span></p>
<h3 class="calibre7"><br class="calibre12" /> How can the output of a command line operation be retrieved?</h3>
<p class="calibre8"><span class="tbd"><span class="rm">A small freeware utility <a href="http://www.autohotkey.com/misc/cb.zip" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">cb.zip</a> captures up to 512 KB of output from a command or program. The text is captured to the clipboard, which a script can access via the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard variable</a>. Example:<br class="calibre12" /> RunWait %comspec% /c dir | cb.exe<br class="calibre12" /> MsgBox %clipboard%</span></span> <span class="x11">This is possible with the optional option OutputVarStdout.</span></p>
<div class="tbd">
<h3 class="calibre7"> <br class="calibre12" /> How can Winamp be controlled even when it isn't active?</h3>
<p class="calibre8">See <a href="#Winamp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Automating Winamp</a>.</p>
</div>
<h3 class="calibre7"><br class="calibre12" /> How to detect when a web page is finished loading?</h3>
<p class="calibre8">The technique in the following example will work with MS Internet Explorer for most pages. A similar technique might work in other browsers:</p>
<pre class="calibre22">Run, www.yahoo.com
MouseMove, 0, 0 ; Prevents the status bar from showing a mouse-hover link instead of "Done".
<span class="tbd">WinWait</span>, Yahoo! - Microsoft Internet Explorer
WinActivate
<span class="tbd">StatusBarWait</span>, Done, 30
if ErrorLevel &lt;&gt; 0
MsgBox, The wait timed out or the window was closed.
else
MsgBox, The page is done loading. </pre>
<h3 class="calibre7"><br class="calibre12" /> How can dates and times be compared or manipulated?</h3>
<p class="calibre8">The <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a> command can add or subtract a quantity of days, hours, minutes, or seconds to a time-string that is in the <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format. The following example subtracts 7 days from the specified time: EnvAdd, VarContainingTimestamp, -7, days</p>
<p class="calibre8">To determine the amount of time between two dates or times, see <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a>, which gives an example. Also, the built-in variable <a href="#Variables.htm__Now" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="tbd">A_Now</span></a> contains the current local time.</p>
<h3 class="calibre7"><br class="calibre12" /> How can the built-in Windows shortcut keys, such as Win+U (Utility Manager) and Win+R (Run), be changed or disabled?</h3>
<p class="calibre8">Here are some <a href="#Override.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">examples</a>.</p>
<h3 class="calibre7"><br class="calibre12" /> How can <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>'s button names be changed?</h3>
<p class="calibre8">Here is an <a href="#MsgBoxButtonNames.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">example</a>.</p>
<h3 class="calibre7"><br class="calibre12" /> How can performance be improved for games or at other times when the CPU is under heavy load? </h3>
<p class="calibre8">If you find that <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a> and/or <a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a> are less responsive than expected while the CPU is under heavy load, raising the script's priority may help. To do this, include the following line near the top of the script, which increases its priority from normal to high. This tells the operating system to pay more attention to it:<br class="calibre12" /> <span class="tbd">Process, Priority, , High</span></p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Hotkeys.htm" href="#Hotkeys.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Hotkeys</span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Hotkeys are defined by creating a subroutine label in a script file with two colons instead of one. In the below example, Win-Y will become a hotkey which implicitly<a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> gosubs</a> the #y label, executing the statements until the first <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">return</a> or <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">exit</a> is encountered:</p>
<p class="calibre8">#y::<br class="calibre12" /> WinActivate, Untitled - Notepad<br class="calibre12" /> return</p>
<p class="calibre8"> </p>
<p class="calibre8">If a hotkey label needs only a single line, it can be included to the right of the double-colon. In other words, the <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">return</a> is implicit:</p>
<p class="calibre8">#y::WinActivate, Untitled - Notepad</p>
<p class="calibre8"> </p>
<p class="calibre8"><a class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>You can use the following symbols to define hotkeys:</p>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">Symbol</strong></td>
<td class="calibre4"><strong class="calibre14">Description</strong></td>
</tr>
<tr class="calibre3">
<td width="30" class="calibre4"><strong class="calibre14">#</strong></td>
<td class="calibre4">Win (Windows Key)</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">!</strong></td>
<td class="calibre4">Alt</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">^</strong></td>
<td class="calibre4">Control</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">+</strong></td>
<td class="calibre4">Shift</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">&lt;</strong></td>
<td class="calibre4"><span class="tbd">Use the left key of the pair. e.g. &lt;!a is the same as !a except that only the left Alt key will trigger it.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">&gt;</strong></td>
<td class="calibre4"><span class="tbd">Use the right key of the pair.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">&lt;^&gt;!</strong></td>
<td class="calibre4"><a id="Hotkeys.htm__AltGr" href="#Hotkeys.htm__AltGr" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> AltGr (alternate graving). If your keyboard layout has an AltGr key instead of a right-Alt key, this series of symbols can usually be used to stand for AltGr (requires Windows NT/2k/XP+). For example:<br class="calibre12" /> &lt;^&gt;!m::MsgBox You presssed AltGr+m.<br class="calibre12" /> ^!m::MsgBox You pressed Ctrl+Alt+m.</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">*</strong></td>
<td class="calibre4">Wildcard: Fire the hotkey even if extra modifiers are being held down. Example:<br class="calibre12" /> *ScrollLock::Run, Notepad ; Launch notepad regardless of whether any control/alt/shift/win keys are also down. This feature is not supported in Win95/98/ME.</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">~</strong></td>
<td class="calibre4">
<p class="calibre8">This hotkey's native function shouldn't be suppressed (hidden from the system) when the hotkey fires. For example, in the below, the mouse button click will be sent to the active window when it normally wouldn't be:<br class="calibre12" /> ~RButton::Sleep, 1<br class="calibre12" /> ~RButton &amp; C::Run, Calc</p>
<p class="calibre8"><span class="tbd">Note: Special hotkeys that are substitutes for <a href="#Hotkeys.htm__AltTab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">alt-tab</a> always ignore this setting.</span></p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14"><span class="rm">$</span></strong></td>
<td class="calibre4">
<div class="rm">
<p class="calibre8"><a id="Hotkeys.htm__prefixdollar" href="#Hotkeys.htm__prefixdollar" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> This is usually only necessary if the script uses the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command to send the keys that comprise the hotkey itself, which would otherwise cause it to fire unintentionally. The exact behavior of the $ prefix varies depending on operating system:</p>
<p class="calibre8">On Windows 95/98/Me and AutoHotkey v1.0.23+: The hotkey is disabled during the execution of its <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> and re-enabled afterward. As a side-effect, if <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a> is set higher than 1, it will behave as though set to 1 for such hotkeys.</p>
<p class="calibre8">On other operating systems and for all versions of AutoHotkey: The $ prefix forces the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a> to be used to implement this hotkey, which as a side-effect prevents the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command from triggering it. The $ prefix is equivalent to having specified <a href="#h_UseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#UseHook</a> prior to the definition of this hotkey.</p>
</div>
<div class="x11">This flag is the default and cannot be configured. Hotkeys can arbitrarily send their own or other grabbed keys because all hotkeys are disabled while any Send-like action takes place.</div>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14"><span class="x11">UP</span></strong></td>
<td class="calibre4">
<div class="x11">
<p class="calibre8">The word UP may follow the name of a hotkey to cause the hotkey to fire upon release of the key rather than when the key is pressed down. The following example remaps the left Win to become the left Ctrl:<br><br>
*LWin::Send {LControl down}<br>
*LWin Up::Send {LControl up}<br><br>
Please note: This only works unreliably, and in the above example, LControl will be properly emulated, however, the CTRL effect will not be active. It is unsure if this is possible at all with X11 requests; help needed. In other words, you can currently only somewhat remap non-modifier keys such as A or Tab.<br>
"Up" can also be used with normal hotkeys as in this example: ^!r Up::MsgBox You pressed and released Ctrl+Alt+R.</p>
</div>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"><strong class="calibre14">(See the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Key List</a> for a complete list of key and mouse/joystick button names)</strong></p>
<p class="calibre8"> </p>
<p class="calibre8">Hotkey labels can be used as if they were normal labels: You can <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>/<a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Goto</a> them and define more than one hotkey label to do the same subroutine, such as in this example:<br class="calibre12" /> ^Numpad0::<br class="calibre12" /> ^Numpad1::<br class="calibre12" /> MsgBox, Both of the above hotkeys will execute this subroutine.<br class="calibre12" /> return<br class="calibre12" />
<br class="calibre12" /> A key or key combination can be disabled for the entire system by having it do nothing. For example, to disable the right Windows key:<br class="calibre12" /> RWIN::return<br class="calibre12" />
<br class="calibre12" /> Hotkeys can be also be created, disabled, or enabled while the script is running by using the <a href="#Hotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a> command. <br class="calibre12" />
<br class="calibre12" /> Note: The program is <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">quasi multi-threaded</a>, which allows a new hotkey to be launched even when a previous hotkey subroutine is still running. For example, new hotkeys can be launched even while a <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> is being displayed by the current hotkey.<br class="calibre12" />
</p>
<p class="calibre8">See <a href="#HotkeyFeatures.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">advanced features</a> for an overview. Here is some more detailed information:<br class="calibre12" />
<span class="tbd">
<br class="calibre12" /> You can define a custom combination of two keys by using " &amp; " between them. In the below example, you would hold down Numpad0 then press the second key to trigger the hotkey:<br class="calibre12" /> Numpad0 &amp; Numpad1::AltTab<br class="calibre12" /> Numpad0 &amp; Numpad2::ShiftAltTab<br class="calibre12" />
<br class="calibre12" /> In the above example, Numpad0 becomes a <em class="calibre21">prefix key</em>. Prefix keys can also be assigned their own actions such as in this example, but their action will only be triggered when the key is released and didn't modify any hotkeys while it was held down:<br class="calibre12" /> Numpad0::Run, calc.exe<br class="calibre12" />
<br class="calibre12" /> In v1.0.10+, if the tilde (~) operator is used with a <em class="calibre21">prefix key</em> even once, that prefix will always be sent through to the active window. For example, in both of the below hotkeys, the right-click will be non-suppressed even though only one of the definitions contains a tilde:<br class="calibre12" /> ~RButton &amp; LButton::MsgBox You pressed the left mouse button while holding down the right.<br class="calibre12" /> RButton &amp; WheelUp::MsgBox You turned the mouse wheel up while holding down the right button.<br class="calibre12" />
<br class="calibre12" />
<a id="Hotkeys.htm__AltTab" href="#Hotkeys.htm__AltTab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> AltTab and ShiftAltTab are two of the special commands that are only recognized when used with hotkeys. They can also be used with mouse buttons and mousewheel rotation, as can any other script commands as well. Example: <br class="calibre12" /> LAlt &amp; LButton::AltTab<br class="calibre12" /> LAlt &amp; WheelDown::AltTab<br class="calibre12" /> LAlt &amp; WheelUp::ShiftAltTab<br class="calibre12" />
<br class="calibre12" /> The mouse wheel can be made into an entire substitute for Alt-tab. Clicking the button will display the menu and turning the wheel will navigate through it:<br class="calibre12" /> MButton::AltTabMenu<br class="calibre12" /> WheelDown::AltTab<br class="calibre12" /> WheelUp::ShiftAltTab<br class="calibre12" />
<br class="calibre12" />
<a class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>The other Alt-tab actions available are AltTabAndMenu (if the menu is displayed, move forward in it; otherwise, display the menu) and AltTabMenuDismiss (close the Alt-tab menu). Currently, all Alt-tab actions must be assigned directly to a hotkey as in the examples above (i.e. they <strong class="calibre14">can't</strong> be used as though they were commands).<br class="calibre12" />
<br class="calibre12" /> You can force the Numlock, Capslock, and Scrolllock keys to be AlwaysOn or AlwaysOff. For example: <br class="calibre12" />
<a href="#SetNumScrollCapsLockState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetNumlockState</a>, AlwaysOn<br class="calibre12" />
</span>
<span class="rm"><br class="calibre12" /> Windows' built-in hotkeys such as Win-E (#e) and Win-R (#r) can be individually overridden by assigning them to an action in the script. This feature is not implemented on Win95/98/ME due to the limitations of those OSes. See the <a href="#Override.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">override page</a> for details. <br class="calibre12" /></span>
<br class="calibre12" /> Each numpad key can be made to launch two different hotkey subroutines depending on the state of Numlock. Alternatively, a numpad key can be made to launch the same subroutine regardless of the Numlock state, such as in this example:<br class="calibre12" /> NumpadEnd::<br class="calibre12" /> Numpad1::<br class="calibre12" /> MsgBox, This hotkey is launched regardless of whether Numlock is on.<br class="calibre12" /> return<br class="calibre12" />
<br class="calibre12" />
<strong class="calibre14">Magic words, abbreviation expansion (auto-replace), and "hot strings"</strong> (requires XP/2k/NT)<strong class="calibre14">:</strong> These are described in the <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstrings section</a>.
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Hotstrings.htm" href="#Hotstrings.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Hotstrings and Auto-replace </span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Although hotstrings are mainly used to expand abbreviations as you type them (auto-replace), they can also be used to launch any scripted action. In this respect, they are similar to <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a> except that they are typically composed of more than one character (that is, a string).</p>
<p class="calibre8">When the user types a hotstring, its action is triggered, much like a hotkey. However, unlike hotkeys, the keystrokes that comprise a hotstring are never suppressed, that is, they are never hidden from the active window.</p>
<p class="calibre8">To define a hotstring, enclose the triggering abbreviation between pairs of double colons as in this example: </p>
<p class="calibre8">::btw::by the way</p>
<p class="calibre8">In the above example, the abbreviation btw will be automatically replaced with "by the way" whenever the user types it. However, by default the user must complete the abbreviation by typing one of the standard ending characters such as space, period, or enter. Ending characters consist of the following: <strong class="calibre14">-()[]{}':;"/\,.?!`n `t </strong>(note that `n is Enter, `t is Tab, and that there is a plain space between `n and `t). This set of characters can be changed by following this example, which sets the new ending characters for <u class="calibre20">all</u> hotstrings, not just the ones physically beneath it: <br class="calibre12" />
<em class="calibre21">#Hotstring EndChars -()[]{}:;'"/\,.?!`n `t</em>
</p>
<p class="calibre8">The "by the way" example above is known as an auto-replace hotstring because the typed text is automatically erased and replaced by the string specified after the second pair of colons. By contrast, a hotstring may also be defined to perform any custom action as in this example:<br class="calibre12" /> ::btw::<br class="calibre12" /> MsgBox You typed "btw".<br class="calibre12" /> return</p>
<p class="calibre8">Even though the above is not an auto-replace hotstring, the abbreviation typed by the user is erased by default. This is done via automatic backspacing, which can be disabled as described in the options below.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17">Options</span></p>
<p class="calibre8">A hotstring's default behavior can be changed in two possible ways:</p>
<ol class="calibre19">
<li class="calibre11">The <a href="#h_Hotstring.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Hotstring</a> directive, which affects all hotstrings physically beneath that point in the script. Example:<br class="calibre12" /> #Hotstring c r ; Case sensitive and "send raw" </li>
<li class="calibre11">By including one or more of the following options inside a hotstring's first pair of colons. Example:<br class="calibre12" /> :cr:Btw::By the way ; Case sensitive and "send raw"</li>
</ol>
<p class="calibre8">Note: When specifying more than one option from the list below, spaces may be optionally included between them.<br class="calibre12" />
<br class="calibre12" />
<strong class="calibre14">B0</strong> (B followed by a zero): Automatic backspacing is <u class="calibre20">not</u> done to erase the abbreviation typed by the user. Use a plain <strong class="calibre14">B</strong> to turn backspacing back on after it was previously turned off.
</p>
<p class="calibre8"><strong class="calibre14">C</strong>: Case sensitive: When typed by the user, the abbreviation must exactly match the case defined in the script. Use <strong class="calibre14">C0</strong> to turn case sensitivity back off. Note: If you need to define two hotstrings that are identical except for their varying case, use extra spaces between the first pair of colons to distinguish one from the other. This is necessary because hotstrings are labels, and each label must be unique. In the below example, the first hotstring is made distinct from the second by including an extra space between its first pair of colons:<br class="calibre12" /> :c :ceo::chief executive officer <br class="calibre12" /> :c:CEO::Chief Executive Officer</p>
<p class="calibre8"><strong class="calibre14">C1</strong>: <span class="tbd">Do not conform to typed case. Use this option to make auto-replace hotstrings case insensitive and prevent them from conforming to the case typed by the user. Use <strong class="calibre14">C0</strong> to make hotstrings conform again.</span></p>
<p class="calibre8">Hotstrings that conform to typed case will produce the replacement text in all caps if the user typed the abbreviation in all caps. If the user typed only the first letter in caps, the first letter of the replacement will also be capitalized (if it is a letter). If the user typed the case in any other way, the replacement is sent exactly as defined.</p>
<p class="calibre8"><strong class="calibre14">Kn</strong>: Key-delay: A delay of length 0 is normally done between keystrokes for all hotstrings that use auto-backspacing or auto-replacement. Zero is recommended for most purposes since it is both fast and able to cooperate well with other processes (due to internally doing a <a href="#Sleep.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sleep 0</a>). If a different delay is desired, specify for <strong class="calibre14">n</strong> the new delay. Use -1 to have no delay at all, which is useful to make auto-replacements faster if your CPU is frequently under heavy load from background processes. <span class="x11">Only considered for the automatic backspacing. For the speed of the actual typing, use SetKeyDelay instead.</span></p>
<p class="calibre8"><strong class="calibre14">O</strong>: Omit the ending character of auto-replace hotstrings when the replacement is produced. This is useful when you want a hotstring to be kept unambiguous by still requiring an ending character, but don't actually want the ending character to be shown on the screen. For example, if <em class="calibre21">:o:ar::aristocrat</em> is a hotstring, typing "ar" followed by a space will produce "aristocrat" with no trailing space, which allows you to make the word plural or possessive without having to backspace. Use <strong class="calibre14">O0</strong> (the letter O followed by a zero) to turn this option back off. </p>
<p class="calibre8"><strong class="calibre14">P</strong>: The <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">priority</a> of the hotstring. <span class="rm">This option has no effect on auto-replace hotstrings.</span> <span class="x11">Yes it does</span></p>
<p class="calibre8"><strong class="calibre14">R</strong>: Send the replacement text raw, that is, exactly as it appears rather than translating {Enter} to an ENTER keystroke, ^c to Control-C, etc. Use <strong class="calibre14">R0</strong> to turn this option back off.</p>
<p class="calibre8"><strong class="calibre14">*</strong>: An ending character (e.g. space, period, or enter) is not required to trigger the hotstring. Use <strong class="calibre14">*0</strong> to turn this option back off. In the example below, the replacement occurs the moment the @ character is typed:<br class="calibre12" /> :*:js@::jsmith@somedomain.com</p>
<p class="calibre8"><strong class="calibre14">?</strong>: <span class="tbd">The hotstring will be triggered even when it is inside another word, that is, when the character typed immediately before it is alphanumeric. For example, if <em class="calibre21">:?:al::airline</em> is a hotstring, typing "practical " would produce "practicairline ". Use <strong class="calibre14">?0</strong> to turn this option back off.</span></p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17">Remarks</span></p>
<p class="calibre8"><span class="rm">Variable references such as %MyVar% are not currently supported within the replacement text. To work around this, don't make such hotstrings auto-replace; instead use the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command in the body of the hotstring's subroutine.</span><span class="x11">Yes they are</span></p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_EndChar</strong> contains the ending character that was pressed by the user to trigger the most recent <span class="rm">non-auto-replace</span> hotstring. If no ending character was required (due to the * option), it will be blank. This variable is useful when making hotstrings that use the Send command or whose behavior should vary depending on which ending character was typed by the user. To send the ending character itself, use <em class="calibre21">"SendRaw %A_EndChar%"</em> (SendRaw is used because characters such as !{} would not be sent correctly by the normal <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command).</p>
<p class="calibre8">Although commas, percent signs and single-colons within hotstring definitions <u class="calibre20">do not</u> need to be <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escaped</a>, accents and those semicolons having a space or tab to their left require it. See <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape sequences</a> for a complete list.</p>
<p class="calibre8">Although the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send command's syntax</a> is supported in auto-replacement text (unless the raw option is used), the hotstring abbreviations themselves do not use this. Instead, specify `n for the ENTER key and `t (or a literal tab) for TAB (see <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape sequences</a> for a complete list). In the following example, the hotstring would be triggered when the user types "ab" followed by a tab: ::ab`t::</p>
<p class="calibre8">Spaces and tabs are treated literally within hotstring definitions. For example, the following would produce two different results:<br class="calibre12" /> ::btw::by the way<br class="calibre12" /> ::btw:: by the way</p>
<p class="calibre8">Each hotstring abbreviation can be no more than 30 characters long. The program will warn you if this length is exceeded. By contrast, the length of hotstring's replacement text is limited only by AutoHotkey's maximum line length, which is 16,383 characters.</p>
<p class="calibre8">The order in which hotstrings are defined determines their precedence with respect to each other. In other words, if more than one hotstring matches something typed by the user, only the first one will take effect.</p>
<p class="calibre8">Any backspacing done by the user is taken into account for the purpose of detecting hotstrings. However, the use of arrow keys, PageUp, PageDown, Home, and End to navigate within an editor will cause the hotstring recognition process to reset. In other words, it will begin waiting for an entirely new hotstring.</p>
<p class="calibre8">A hotstring may be typed even when the active window is ignoring the user's keystrokes. In other words, the hotstring will still fire even though the triggering abbreviation is never visible. In addition, the backspace key will undo the most recently typed keystroke even though you can't see the effect.</p>
<p class="calibre8">It is possible to <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a> or <a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Goto</a> a hotstring label by including its first pair of colons (including any option symbols) in front of its name. However, if there are no options between the colons, you must escape the colon pair as in this example: Gosub `::btw</p>
<p class="calibre8">Although hotstrings are <span class="tbd">not monitored and will not be triggered during the course of an invisible</span> <a href="#Input.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Input</a> command, visible Inputs are capable of triggering them. </p>
<p class="calibre8">Hotstrings can never be triggered by keystrokes produced by any AutoHotkey script. This avoids the possibility of an infinite loop wherein hotstrings trigger each other over and over.</p>
<p class="calibre8">The <a href="#Input.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Input</a> command is more flexible than hotstrings for certain purposes. For example, it allows your keystrokes to be invisible from the active window (such as a game). It also supports non-character ending keys such as Escape. </p>
<p class="calibre8">The <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a> is automatically used by any script that contains hotstrings.</p>
<p class="calibre8">Hotstrings behave identically to hotkeys in the following ways:</p>
<ul class="calibre10">
<li class="calibre11">They are affected by the <a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Suspend</a> command.</li>
<li class="calibre11">They obey <a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a> and <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a> (but not <a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a>).</li>
<li class="calibre11">Scripts containing hotstrings are automatically <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a>.</li>
<li class="calibre11"><span class="rm">Non-auto-replace</span> hotstrings will create a new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> when launched. In addition, they will update the built-in hotkey variables such as <a href="#Variables.htm__ThisHotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ThisHotkey</a>.</li>
</ul>
<hr class="calibre24" />
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="KeyList.htm" href="#KeyList.htm">#</a>
<h2 class="calibre9"><span class="calibre23">List of Keys and Mouse/Joystick Buttons</span></h2>
<hr size="2" class="calibre24" />
<h4 class="calibre25">Mouse</h4>
<p class="calibre8">LButton - the left mouse button <br class="calibre12" /> RButton - the right mouse button <br class="calibre12" /> MButton - the middle or wheel mouse button</p>
<p class="calibre8"> WheelDown - this is equivalent to rotating the mouse wheel down (toward you) <br class="calibre12" /> WheelUp - the opposite of the above</p>
<p class="calibre8"> XButton1 - a button that appears only on certain mice <br class="calibre12" /> XButton2 - a button that appears only on certain mice</p>
<div class="tbd">
<h4 class="calibre25"><br class="calibre12" /> Joystick <span class="style2">(requires v1.0.10+)</span></h4>
<p class="calibre8"><strong class="calibre14">Joy1 through Joy32</strong>: The buttons of the joystick. To help determine the button numbers for a particular joystick, use this <a href="#JoystickTest.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">test script</a>. Note that <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey prefix symbols</a> such as ^ (control) and + (shift) are not supported. Also note that the pressing of joystick buttons always "passes through" to the active window if that window is designed to detect the pressing of joystick buttons.</p>
<p class="calibre8">Although the following Joystick control names cannot be used as hotkeys, they can be used with <a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a>:<br class="calibre12" />
<strong class="calibre14">JoyX, JoyY, and JoyZ</strong>: The X (horizontal), Y (vertical), and Z (altitude/depth) axes of the joystick.<br class="calibre12" />
<strong class="calibre14">JoyR</strong>: The rudder or 4th axis of the joystick. <br class="calibre12" />
<strong class="calibre14">JoyU and JoyV</strong>: The 5th and 6th axes of the joystick. <br class="calibre12" />
<strong class="calibre14">JoyPOV</strong>: The point-of-view (hat) control.<br class="calibre12" />
<strong class="calibre14">JoyName</strong>: The name of the joystick or its driver. <br class="calibre12" />
<strong class="calibre14">JoyButtons</strong>: The number of buttons supported by the joystick (not always accurate). <br class="calibre12" />
<strong class="calibre14">JoyAxes</strong>: The number of axes supported by the joystick.<br class="calibre12" />
<strong class="calibre14">JoyInfo</strong>: Provides a string consisting of zero or more of the following letters to indicate the joystick's capabilities: <strong class="calibre14">Z</strong> (has Z axis), <strong class="calibre14">R</strong> (has R axis), <strong class="calibre14">U</strong> (has U axis), <strong class="calibre14">V</strong> (has V axis), <strong class="calibre14">P</strong> (has POV control), <strong class="calibre14">D</strong> (the POV control has a limited number of discrete/distinct settings), <strong class="calibre14">C</strong> (the POV control is continous/fine). Example string: ZRUVPD
</p>
<p class="calibre8"> <strong class="calibre14">Multiple Joysticks</strong>: If the computer has more than one and you want to use one beyond the first, include the joystick number in front of the control name. For example, 2joy1 is the second joystick's first button.</p>
<p class="calibre8"><strong class="calibre14">Using Joystick as Mouse</strong>: <a href="#JoystickMouse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">This script</a> converts a joystick into a two-button mouse.</p>
</div>
<h4 class="calibre25"><br class="calibre12" /> Keyboard</h4>
<p class="calibre8"> <strong class="calibre14">Note: The names of the letter and number keys are the same as that single letter or digit. For example: b is the "b" key and 5 is the "5" key.</strong></p>
<p class="calibre8">Space - the spacebar<br class="calibre12" /> Tab<br class="calibre12" /> Enter (or Return)<br class="calibre12" /> Escape (or Esc)<br class="calibre12" /> Backspace (or BS)</p>
<p class="calibre8"> Delete (or Del)<br class="calibre12" /> Insert (or Ins)<br class="calibre12" /> Home<br class="calibre12" /> End<br class="calibre12" /> PgUp<br class="calibre12" /> PgDn<br class="calibre12" /> Up<br class="calibre12" /> Down<br class="calibre12" /> Left<br class="calibre12" /> Right</p>
<p class="calibre8">ScrollLock<br class="calibre12" /> CapsLock<br class="calibre12" /> NumLock</p>
<p class="calibre8">NumpadDiv - the slash key<br class="calibre12" /> NumpadMult - the asterisk key<br class="calibre12" /> NumpadAdd - the plus key<br class="calibre12" /> NumpadSub - the minus key<br class="calibre12" /> NumpadEnter - the Enter key</p>
<p class="calibre8">The following keys are used when Numlock is OFF:<br class="calibre12" /> NumpadDel<br class="calibre12" /> NumpadIns<br class="calibre12" /> NumpadClear - same physical key as Numpad5 on most keyboards<br class="calibre12" /> NumpadUp<br class="calibre12" /> NumpadDown<br class="calibre12" /> NumpadLeft<br class="calibre12" /> NumpadRight<br class="calibre12" /> NumpadHome<br class="calibre12" /> NumpadEnd<br class="calibre12" /> NumpadPgUp<br class="calibre12" /> NumpadPgDn</p>
<p class="calibre8">The following keys are used when Numlock is ON:<br class="calibre12" /> Numpad0<br class="calibre12" /> Numpad1<br class="calibre12" /> Numpad2<br class="calibre12" /> Numpad3<br class="calibre12" /> Numpad4<br class="calibre12" /> Numpad5<br class="calibre12" /> Numpad6<br class="calibre12" /> Numpad7<br class="calibre12" /> Numpad8<br class="calibre12" /> Numpad9<br class="calibre12" /> NumpadDot - the decimal point (period) key</p>
<p class="calibre8"><strong class="calibre14">F1 through F24</strong> - The 12 or more function keys at the top of most keyboards.</p>
<p class="calibre8">AppsKey - this is the key that invokes the right-click context menu.</p>
<p class="calibre8">LWin - the left windows key <br class="calibre12" /> RWin - the right windows key <br class="calibre12" /> Control (or Ctrl) <br class="calibre12" /> Alt<br class="calibre12" /> Shift</p>
<p class="calibre8">Note: For the most part, these next 6 keys are <strong class="calibre14">not</strong> supported by Windows 95/98/Me. Use the above instead:<br class="calibre12" /> LControl (or LCtrl) - the left control key <br class="calibre12" /> RControl (or RCtrl) - the right control key <br class="calibre12" /> LShift<br class="calibre12" /> RShift<br class="calibre12" /> LAlt<br class="calibre12" /> RAlt -- Note: If your keyboard layout has AltGr instead of RAlt, you can probably use it as a hotkey prefix via <strong class="calibre14">&lt;^&gt;!</strong> as described <a href="#Hotkeys.htm__AltGr" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">here</a>. In addition, "LControl &amp; RAlt::" would make AltGr itself into a hotkey.</p>
<p class="calibre8">PrintScreen<br class="calibre12" /> CtrlBreak<br class="calibre12" /> Pause<br class="calibre12" /> Break</p>
<p class="calibre8">Help - this probably doesn't exist on most keyboards. It's usually not the same as F1.<br class="calibre12" /> Sleep - note that the sleep key on some keyboards might not work with this.</p>
<p class="calibre8">The following exist only on Multimedia or Internet keyboards that have extra buttons or keys:<br class="calibre12" /> Browser_Back<br class="calibre12" /> Browser_Forward<br class="calibre12" /> Browser_Refresh<br class="calibre12" /> Browser_Stop<br class="calibre12" /> Browser_Search<br class="calibre12" /> Browser_Favorites<br class="calibre12" /> Browser_Home<br class="calibre12" /> Volume_Mute<br class="calibre12" /> Volume_Down<br class="calibre12" /> Volume_Up<br class="calibre12" /> Media_Next<br class="calibre12" /> Media_Prev<br class="calibre12" /> Media_Stop<br class="calibre12" /> Media_Play_Pause<br class="calibre12" /> Launch_Mail<br class="calibre12" /> Launch_Media<br class="calibre12" /> Launch_App1<br class="calibre12" /> Launch_App2</p>
<p class="calibre8"> </p>
<div class="tbd">
<h4 class="calibre25"><a id="KeyList.htm__SpecialKeys" href="#KeyList.htm__SpecialKeys" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Special Keys</h4>
<p class="calibre8">If your keyboard has a key not listed above, you might still be able to make it a hotkey by using the following steps (this technique requires v1.0.08+ and is currently not supported on Windows 95/98/Me):</p>
<ol class="calibre19">
<li class="calibre11">Ensure that at least one script is running that has the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a> installed.</li>
<li class="calibre11">Double-click that script's tray icon to open its main window.</li>
<li class="calibre11">Press one of the "mystery keys" on your keyboard.</li>
<li class="calibre11">Select the menu item "View-&gt;Key history"</li>
<li class="calibre11">Scroll down to the bottom of the page. Somewhere near the bottom of the history list are the key-down and key-up events for your key. NOTE: Some keys do not generate events and thus will not be visible here. If this is the case, you cannot make that particular key a hotkey because your keyboard driver or hardware handles it at a level too low for AutoHotkey to access. In that case, you can try reconfiguring or removing any extra software that came with your keyboard or changing the keyboard driver to a more standard one such as the one built into the OS.</li>
<li class="calibre11">If your key does generate events, make a note of the 3-digit value in the second column of the list (e.g. 159).</li>
<li class="calibre11">To define this key as a hotkey, follow this example:<br class="calibre12" /> SC159:: ; Replace 159 with your key's value.<br class="calibre12" /> MsgBox, %A_ThisHotKey% was pressed.<br class="calibre12" /> return</li>
</ol>
<p class="calibre8">As an alternative or addition to the above: To remap some other key to become a "mystery key", follow this example (requires v1.0.14+): #c::Send {vkFFsc159} ; Replace 159 with the value discovered above. Replace FF (if needed) with the key's virtual key, which can be discovered in the first column of "View-&gt;Key history".</p>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Scripts.htm" href="#Scripts.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Scripts</span></h2>
<hr size="2" class="calibre24" />
<h3 class="calibre7">How Scripts Are Run -- The Auto-execute Section</h3>
<p class="calibre8">Scripts are <a href="#Performance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">optimized</a> and validated when launched. Any syntax errors will be displayed, and they must be corrected before the script can run.</p>
<p class="calibre8">The program loads a script into memory line by line, and each line may be up to 16,383 characters long. After this, it runs the script from the top, continuing until it encounters a <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a>, <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey/hotstring label, </a>or the physical end of the script (whichever comes first). This top portion of the script is referred to as the <em class="calibre21">auto-execute</em> section.</p>
<p class="calibre8">A script that is not <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a> and that lacks <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a> and <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstrings</a> will terminate after the <em class="calibre21">auto-execute</em> section has completed. Otherwise, it will stay running in an idle state, responding to events such as hotkeys, hotstrings, <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI events</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu items</a>, and <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timers</a>.</p>
<p class="calibre8">Every subroutine launched by a <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstring</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI event</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a> starts off fresh with the default values for the following attributes as set in the <em class="calibre21">auto-execute</em> section. If unset, the standard defaults will apply (as documented on each of the following pages):</p>
<p class="calibre8"> <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>
<a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a><br class="calibre12" />
<a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a> <br class="calibre12" />
<a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a> <br class="calibre12" />
<a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a> <br class="calibre12" />
<a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a> <br class="calibre12" />
<a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a><br class="calibre12" />
<a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a><br class="calibre12" />
<a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a><br class="calibre12" />
<a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a><br class="calibre12" />
<a href="#SetStoreCapslockMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetStoreCapslockMode</a> <br class="calibre12" />
<a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim<br class="calibre12" />
</a><a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a> <br class="calibre12" />
<a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>
</p>
<p class="calibre8">NOTE: If the <em class="calibre21">auto-execute</em> section takes a long time to complete (or never completes), the default values for the above settings will be put into effect after 100 milliseconds. Thus, it's usually best to make any desired changes to the defaults at the top of scripts that contain <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a>, <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstrings</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timers</a>, or <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu items</a>. Also note that each <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> retains its own collection of the above settings. Changes made to those settings will not affect other <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a>.</p>
<h3 class="calibre7"><br class="calibre12" /> Escape Sequences </h3>
<p class="calibre8">AutoHotkey's default <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape character</a> is accent ` (upper left corner of most English keyboards). This avoids the need for backslashes in filenames to be escaped. For example, in a .ahk script a filename can be written as <em class="calibre21">/a/b\c/d</em> rather than needing double-backslashes.</p>
<p class="calibre8">Since commas and percent signs have special meaning in the AutoHotkey language, use `, to specify a literal comma and `% to specify an actual percent sign. One of the exceptions to this is <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, which does not require commas to be escaped. See <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#EscapeChar</a> for a complete list of escape sequences.</p>
<h3 class="calibre7"><br class="calibre12" /> Comments in Scripts </h3>
<p class="calibre8">Scripts can be commented by using a semicolon at the beginning of a line. Comments may also be added to the end of a command, in which case the semicolon must have at least one space or tab to its left. For example:</p>
<p class="calibre8">; This line is a full line comment.<br class="calibre12" /> WinActivate, Untitled - Notepad ; This is a comment on the same line as a command.<br class="calibre12" />
<br class="calibre12" /> In addition, the /* and */ symbols can be used to comment out an entire section, but only if the symbols appear at the beginning of a line as in this example: <br class="calibre12" /> /*<br class="calibre12" /> MsgBox, This line is commented out (disabled).<br class="calibre12" /> MsgBox, This one too. <br class="calibre12" /> */<br class="calibre12" />
<br class="calibre12" /> Tip: The first comma of any command may be omitted. Example:<br class="calibre12" /> MsgBox This is ok.<br class="calibre12" /> MsgBox, This is ok too.
</p>
<h3 class="calibre7"><br class="calibre12" />
<a id="Scripts.htm__ahk2exe" href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Convert a Script to an <span class="rm">EXE</span> <span class="x11">executable</span> (ahk2exe)
</h3>
<p class="calibre8">A script compiler is included with the program.</p>
<p class="calibre8"> Once a script is compiled, it becomes a standalone executable, meaning that it can be used even on machines where AutoHotkey isn't present (and such <span class="rm">EXE</span><span class="x11">executable</span>s can be distributed or sold with no restrictions). <span class="rm">The compilation process compresses and encrypts all of the following: the script, any files it <a href="#h_Include.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">includes</a>, and any files it has incorporated via the <a href="#FileInstall.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileInstall</a> command.</span></p>
<p class="calibre8">Ahk2Exe can be used in the following ways:</p>
<ol class="calibre19">
<li class="calibre11 tbd">
<p class="calibre8"><strong class="calibre14">GUI Interface</strong>: Run the "Convert .ahk to .exe" item in the Start Menu.</p>
</li>
<li class="calibre11">
<p class="calibre8"><strong class="calibre14">Right-click</strong>: Within an open Explorer window, you can right-click any .ahk file and select <span class="rm">"Compile Script"</span> <span class="x11">"Compile with ahk_x11"</span> <span class="rm">(only available if the script compiler option was chosen when AutoHotkey was installed)</span>. This will create an <span class="rm">EXE</span><span class="x11">executable (same filename, but without the .ahk)</span> file of the same base filename as the script, which will appear after a short time in the same directory. <span class="rm">Note: The EXE file will be produced using the same custom icon and compression level that was last used by Method #1 above <u class="calibre20">and it will not have a password</u>.</span> <span class="x11">Portable binaries have no icons on Linux.</span></p>
</li>
<li class="calibre11">
<p class="calibre8"><strong class="calibre14">Command Line</strong>: The compiler can be run from the command line with the following parameters:<br class="calibre12" /> <span class="rm">Ahk2exe.exe /in MyScript.ahk [/out MyScript.exe][/icon MyIcon.ico][/pass password]</span> <span class="x11">ahk_x11 --compile MyScript.ahk [MyBinary]</span><br class="calibre12" /> Parameters containing spaces should be enclosed in double quotes. If the "out" file is omitted, the EXE will have the same base filename as the script itself.</p>
</li>
</ol>
<p class="calibre8">Important Notes:</p>
<ul class="calibre10">
<li class="calibre11">
<p class="calibre8"><span class="rm">A password should be specified if you plan to distribute your EXE and don't want anyone to be able to view the source code of your script.</span></p>
</li>
<li class="calibre11">
<p class="calibre8">The commands <a href="#h_NoTrayIcon.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#NoTrayIcon</a> and "<a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu, Tray, ShowMainWindow</a>" affect the behavior of compiled scripts.</p>
</li>
<li class="calibre11">
<p class="calibre8">An EXE can be "decompiled" to retrieve the original script <span class="rm">by downloading <a href="http://www.autohotkey.com/download/Exe2Ahk.exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exe2Ahk</a> (this utility should be run from the command prompt). However, any comments (semicolon'd lines) originally present will be lost. </span></p>
</li>
<li class="calibre11"><span class="rm">Custom version info (as seen in Explorer's file-properties dialog) can be added to your compiled scripts by using a utility such as Resource Hacker (freeware) to edit the file "AutoHotkeySC.bin". This file is contained in the compiler subfolder where AutoHotkey was installed. Note: ResHacker will corrupt compiled scripts, which is why only the AutoHotkeySC.bin file should be edited.</span>
<p class="calibre8" />
</li>
</ul>
<div class="tbd">
<h3 class="calibre7"><br class="calibre12" />
<a id="Scripts.htm__cmd" href="#Scripts.htm__cmd" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Passing Command Line Parameters to a Script
</h3>
<p class="calibre8">Scripts support command line parameters. The format is: <br class="calibre12" /> AutoHotkey.exe [<em class="calibre21">Switches</em>] [<em class="calibre21">Script Filename</em>] [<em class="calibre21">Script Parameters</em>]<br class="calibre12" /> CompiledScript.exe [<em class="calibre21">Switches</em>] [<em class="calibre21">Script Parameters</em>] </p>
<p class="calibre8"><em class="calibre21">Switches</em> can be zero or more of the following: <br class="calibre12" /> /f or /force -- Launch unconditionally, skipping any warning dialogs. <br class="calibre12" /> /r or /restart -- Indicate that the script is being restarted (this is also used by the Reload command, internally).<br class="calibre12" /> /ErrorStdOut -- Send syntax errors to stdout rather than displaying a dialog. See <a href="#h_ErrorStdOut.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#ErrorStdOut</a> for details.</p>
<p class="calibre8"><em class="calibre21">Script Filename</em> can be omitted if there are no Script Parameters. If omitted, it will run (or prompt you to create) AutoHotkey.ini in the current working directory.</p>
<p class="calibre8"><em class="calibre21">Script Parameters</em> can be any strings you want to pass into the script (but any string that contains spaces must be enclosed in double quotes). The script sees incoming parameters as the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variables</a> %1%, %2%, and so on. In addition, %0% contains the number of parameters passed (0 if none).</p>
<p class="calibre8">If the number of parameters passed into a script varies (perhaps due to the user dragging and dropping a set of files onto a compiled script), the following example can be used to extract them one by one:</p>
<pre class="calibre22">Loop, %0%
{
StringTrimRight, param, %A_Index%, 0
MsgBox, 4,, Parameter #%A_Index% is %param%. Continue?
IfMsgBox, No
break
}</pre>
<h3 class="calibre7"><br class="calibre12" /> Script Showcase</h3>
<p class="calibre8">See <a href="scripts/" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">this page</a> for some useful scripts.</p>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Variables.htm" href="#Variables.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Variables</span></h2>
<hr size="2" class="calibre24" />
<h3 class="calibre7">Introduction</h3>
<p class="calibre8">Variables are areas of memory set aside to hold <em class="calibre21">values</em>. A <em class="calibre21">value</em> (or <em class="calibre21">string</em> as it is sometimes called) can be any series of characters or digits. For example, the following line assigns a value to the variable named MyVar:<br class="calibre12" /> MyVar = 123abc</p>
<p class="calibre8">To later retrieve the contents of the variable, make a <em class="calibre21">reference</em> to it by enclosing its name in percent signs, as in this example:<br class="calibre12" /> MsgBox, The value in the variable named MyVar is %MyVar%.</p>
<p class="calibre8">However, the parameters of some commands are explicitly defined as input or output variables. In these cases, do <strong class="calibre14">not</strong> enclose the variable in percent signs. For example, neither of the following variables should have percent signs around them: <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><span class="tbd">StringLen</span></a>, OutputVar, InputVar</p>
<p class="calibre8">Variable <strong class="calibre14">names</strong> may consist of numbers, letters, and the following punctuation: # _ @ $ ? [ ]<br class="calibre12" /> (the square brackets might typically be used for <a href="#Arrays.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">arrays</a>, though this is optional). In addition, variable names may start with a number, or even be entirely numeric.</p>
<p class="calibre8">Notes about variable capacity and memory usage:</p>
<ul class="calibre10">
<li class="calibre11"><span class="tbd">Each variable may contain up to 64 MB of text (this limit can be increased with <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a>).</span></li>
<li class="calibre11">When a variable is given a new string longer than its current contents, additional system memory is allocated automatically.</li>
<li class="calibre11">The memory occupied by a large variable can be freed by setting it equal to nothing, e.g. var =</li>
</ul>
<h3 class="calibre7"><br class="calibre12" />
<a id="Variables.htm__env" href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Environment Variables vs. "Normal" Variables
</h3>
<div class="rm">
<p class="calibre8">AutoHotkey does not store its variables as environment variables. This is because performance would be worse and also because the operating system limits such variables to 32 KBytes. Use <a href="#EnvSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSet</a> (not to be confused with <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a>) to explicitly place a value into an environment variable.</p>
<p class="calibre8">Any reference to an undefined or blank variable (e.g. %EmptyVar%) resolves to an empty string unless that variable is defined in the environment (e.g. %ProgramFiles%), in which case the environment's value will be retrieved and used.</p>
</div>
<p class="calibre8"> </p>
<h3 class="calibre7"> Naming Variables to Improve Maintainability</h3>
<p class="calibre8"> Since all variables are global, in a large or complex script it is usually best to use unique names for variables to reduce the possibility of bugs and unwanted side-effects. For example, to call a subroutine in a way that mimics passing parameters and receiving a return value, a convention similar to the following might be useful:<br class="calibre12" />
<br class="calibre12" /> ; Set input "parameters" by using a prefix/acronym to indicate who they're for.<br class="calibre12" /> ; "gce" stands for "GetColorExists":<br class="calibre12" /> gce_x1 = 30<br class="calibre12" /> gce_x2 = 50<br class="calibre12" /> gce_y1 = 0<br class="calibre12" /> gce_y2 = 200<br class="calibre12" /> Gosub, GetColorExists<br class="calibre12" /> MsgBox The subroutine's output is %ColorExists%.<br class="calibre12" /> return<br class="calibre12" />
<br class="calibre12" /> GetColorExists:<br class="calibre12" /> ...<br class="calibre12" /> ; Set the output for the caller using the variable name indicated by the subroutine's name:<br class="calibre12" /> ColorExists = y<br class="calibre12" /> ...<br class="calibre12" /> return
</p>
<p class="calibre8"> </p>
<h3 class="calibre7"><a id="Variables.htm__BuiltIn" href="#Variables.htm__BuiltIn" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Built-in Variables </h3>
<p class="calibre8">The following built-in variables can also be used. Most of them are reserved, meaning that their contents cannot be directly altered by the script:</p>
<h4 class="calibre25">Table of Contents</h4>
<ul class="calibre10">
<li class="calibre11">Special Characters: <a href="#Variables.htm__Space" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Space</a>, <a href="#Variables.htm__Tab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Tab</a></li>
<li class="calibre11">Script Properties: <a href="#Variables.htm__CommandLine" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">command line parameters</a>, <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_WorkingDir</a>, <a href="#Variables.htm__ScriptDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScriptDir</a>, <a href="#Variables.htm__ScriptName" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScriptName</a>, <a href="#Variables.htm__prop" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">(...more...)</a></li>
<li class="calibre11">Date and Time: <a href="#Variables.htm__YYYY" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_YYYY</a>, <a href="#Variables.htm__MM" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_MM</a>, <a href="#Variables.htm__DD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_DD</a>, <a href="#Variables.htm__Hour" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Hour</a>, <a href="#Variables.htm__Min" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Min</a>, <a href="#Variables.htm__Sec" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Sec</a>, <a href="#Variables.htm__date" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">(...more...)</a></li>
<li class="calibre11">Script Settings: <a href="#Variables.htm__BatchLines" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_BatchLines</a>, <a href="#Variables.htm__TitleMatchMode" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_TitleMatchMode</a>, <a href="#Variables.htm__settings" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">(...more...)</a> </li>
<li class="calibre11">User Idle Time: <a href="#Variables.htm__TimeIdle" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_TimeIdle</a>, <a href="#Variables.htm__TimeIdlePhysical" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_TimeIdlePhysical</a></li>
<li class="calibre11">GUI Windows and Menu Bars: <a href="#Variables.htm__Gui" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Gui</a>, <a href="#Variables.htm__GuiControl" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_GuiControl</a>, <a href="#Variables.htm__GuiControlEvent" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_GuiControlEvent</a></li>
<li class="calibre11">Hotkeys, Hotstrings, and Custom Menu Items: <a href="#Variables.htm__ThisHotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ThisHotkey</a>, <a href="#Variables.htm__EndChar" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_EndChar</a>, <a href="#Variables.htm__ThisMenuItem" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ThisMenuItem</a>, <a href="#Variables.htm__h" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">(...more...)</a></li>
<li class="calibre11">Operating System and User Info: <a href="#Variables.htm__OSVersion" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_OSVersion</a>, <a href="#Variables.htm__Screen" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScreenWidth</a>, <a href="#Variables.htm__Screen" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScreenHeight</a>, <a href="#Variables.htm__os" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">(...more...)</a></li>
<li class="calibre11">Misc: <a href="#Variables.htm__Cursor" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Cursor</a>, <a href="#Variables.htm__Caret" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_CaretX</a>, <a href="#Variables.htm__Caret" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_CaretY</a>, <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Clipboard</a>, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a></li>
<li class="calibre11">Loop: <a href="#Variables.htm__Index" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Index</a>, <a href="#Variables.htm__loop" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">(...more...)</a></li>
</ul>
<br class="calibre12" />
<h4 class="calibre25">Special Characters</h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_Space</td>
<td class="calibre4"><a id="Variables.htm__Space" href="#Variables.htm__Space" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> This variable contains a single space character. See <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a> for details.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Tab</td>
<td class="calibre4"><a id="Variables.htm__Tab" href="#Variables.htm__Tab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class=""> This variable contains a single tab character. See <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a> for details.</span></td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25"><a id="Variables.htm__prop" href="#Variables.htm__prop" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Script Properties</h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">1, 2, 3, etc. </td>
<td class="calibre4"><a id="CommandLine" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a><span class="tbd">These variables are automatically created whenever a script is launched with command line parameters. They can be changed and referenced just like normal variable names (for example: %1%). The variable %0% contains the number of parameters passed (0 if none). See the <a href="#Scripts.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">script section</a> for details.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_WorkingDir</td>
<td class="calibre4"><a id="Variables.htm__WorkingDir" href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The script's current working directory, which is where files will be accessed by default. The final backslash is not included unless it is the root directory. Two examples: / and /home. Use <a href="#SetWorkingDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWorkingDir</a> to change the working directory. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ScriptDir</td>
<td class="calibre4"><a id="Variables.htm__ScriptDir" href="#Variables.htm__ScriptDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The full path of the directory where the current script is located. The final backslash is not included.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ScriptName</td>
<td class="calibre4">
<p class="calibre8"><a id="Variables.htm__ScriptName" href="#Variables.htm__ScriptName" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The file name of the current script, without its path, e.g. MyScript.ahk. If the script is <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">compiled</a>, the name will <span class="rm">end in .exe</span> <span class="x11">usually have no file extension</span> instead. Thus, a <span class="rm">good</span> <span class="x11">questionable</span> way for a script to detect whether it is running in compiled form is with the following:<br class="calibre12" />
<a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a>, A_ScriptName,,, FileExt<br class="calibre12" /> if FileExt = ahk<br class="calibre12" />     MsgBox This script is NOT running in compiled form.
</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ScriptFullPath</td>
<td class="calibre4"><a id="Variables.htm__ScriptFullPath" href="#Variables.htm__ScriptFullPath" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The combination of the above two variables to give the complete file specification of the script, e.g. /a/b/MyScript.ahk</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_AhkVersion</td>
<td class="calibre4"><a id="Variables.htm__AhkVersion" href="#Variables.htm__AhkVersion" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="rm"> In versions prior to 1.0.22, this variable is blank. Otherwise, it contains the version of AutoHotkey that is running the script, such as 1.0.22. In the case of a <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">compiled script</a>, the version that was originally used to compile it is reported.</span><span class="x11"> Always contains 1.0.24.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ExitReason</td>
<td class="calibre4"><a id="Variables.htm__ExitReason" href="#Variables.htm__ExitReason" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The most recent reason the script was asked to terminate. This variable is blank unless the script has an <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a> subroutine and that subroutine is currently running or has been called at least once by an exit attempt. See <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a> for details. </span></td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25"><a id="Variables.htm__date" href="#Variables.htm__date" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Date and Time </h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_YYYY</td>
<td class="calibre4"><a id="YYYY" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>Current 4-digit year (e.g. 2004). Synonymous with A_Year. Note: To retrieve a formatted time or date appropriate for your locale and language, use "<a href="#FormatTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FormatTime</a>, OutputVar" (time and long date) or "<a href="#FormatTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FormatTime</a>, OutputVar,, LongDate" (retrieves long-format date).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_MM</td>
<td class="calibre4"><a id="MM" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>Current 2-digit month (01-12). Synonymous with A_Mon.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_DD</td>
<td class="calibre4"><a id="DD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>Current 2-digit day of the month (01-31). Synonymous with A_MDay.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_MMMM</td>
<td class="calibre4"><a id="Variables.htm__MMMM" href="#Variables.htm__MMMM" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">Current month's full name in the current user's language, e.g. July [requires v1.0.16+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_MMM</td>
<td class="calibre4"><a id="Variables.htm__MMM" href="#Variables.htm__MMM" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">Current month's abbreviation in the current user's language, e.g. Jul [requires v1.0.16+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_DDDD</td>
<td class="calibre4"><a id="Variables.htm__DDDD" href="#Variables.htm__DDDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">Current day of the week's full name in the the current user's language, e.g. Sunday [requires v1.0.16+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_DDD</td>
<td class="calibre4"><a id="Variables.htm__DDD" href="#Variables.htm__DDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">Current day of the week's 3-letter abbreviation in the the current user's language, e.g. Sun [requires v1.0.16+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_WDay</td>
<td class="calibre4"><a id="Variables.htm__WDay" href="#Variables.htm__WDay" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Current 1-digit day of the week (1-7). 1 is Sunday in all locales.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_YDay</td>
<td class="calibre4"><a id="Variables.htm__YDay" href="#Variables.htm__YDay" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Current day of the year (1-366). The value is not zero-padded, e.g. 9 is retrieved, not 009. To retrieve a zero-padded value, use the following: <a href="#FormatTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FormatTime</a>, OutputVar, , YDay0 </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_YWeek</td>
<td class="calibre4"><a id="Variables.htm__YWeek" href="#Variables.htm__YWeek" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Current year and week number according to ISO 8601. Example: 200453. To separate the year from the week, use <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a> and <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a>. Definition of week number: If the week containing January 1st has four or more days in the new year, it is considered week 1. Otherwise, it is the last week of the previous year, and the next week is week 1. [requires v1.0.24+] </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Hour</td>
<td class="calibre4"><a id="Variables.htm__Hour" href="#Variables.htm__Hour" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Current 2-digit hour (00-23) in 24-hour time (for example, 17 is 5pm). To retrieve 12-hour time as well as an AM/PM indicator, follow this example: <a href="#FormatTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FormatTime</a>, OutputVar, , h:mm:ss tt </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Min</td>
<td class="calibre4">
<p class="calibre8"><a id="Variables.htm__Min" href="#Variables.htm__Min" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Current 2-digit minute (00-59)</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Sec</td>
<td class="calibre4"><a id="Variables.htm__Sec" href="#Variables.htm__Sec" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Current 2-digit second (00-59)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Now</td>
<td class="calibre4"><a id="Variables.htm__Now" href="#Variables.htm__Now" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current local time in <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_NowUTC</td>
<td class="calibre4"><a id="Variables.htm__NowUTC" href="#Variables.htm__NowUTC" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current Coordinated Universal Time (UTC) in <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format. UTC is essentially the same as Greenwich Mean Time (GMT).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_TickCount</td>
<td class="calibre4">
<p class="calibre8"><a id="Variables.htm__TickCount" href="#Variables.htm__TickCount" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The number of milliseconds that have elapsed since the computer was rebooted. By storing %A_TickCount% in a variable, elapsed time can later be measured by subtracting that variable from the current %A_TickCount% value, as in this example:</p>
<p class="calibre8">start_time = %A_TickCount%<br class="calibre12" /> Sleep, 1000<br class="calibre12" /> elapsed_time = %A_TickCount%<br class="calibre12" /> elapsed_time -= %start_time%<br class="calibre12" /> MsgBox, %elapsed_time% milliseconds have elapsed.<br class="calibre12" />
</p>
</td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25"><a id="Variables.htm__settings" href="#Variables.htm__settings" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Script Settings</h4> (all except A_NumBatchLines require v1.0.13+) <table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_BatchLines</td>
<td class="calibre4 tbd"><a id="Variables.htm__BatchLines" href="#Variables.htm__BatchLines" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> (synonymous with A_NumBatchLines) The current value as set by <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a>. Examples: 200 or 10ms (depending on format).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_TitleMatchMode</td>
<td class="calibre4 tbd"><a id="Variables.htm__TitleMatchMode" href="#Variables.htm__TitleMatchMode" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current mode (1, 2, or 3) set by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_TitleMatchModeSpeed</td>
<td class="calibre4 tbd"><a id="Variables.htm__TitleMatchModeSpeed" href="#Variables.htm__TitleMatchModeSpeed" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current match speed (fast or slow) set by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_DetectHiddenWindows</td>
<td class="calibre4"><a id="Variables.htm__DetectHiddenWindows" href="#Variables.htm__DetectHiddenWindows" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current mode (On or Off) set by <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_DetectHiddenText</td>
<td class="calibre4 tbd"><a id="Variables.htm__DetectHiddenText" href="#Variables.htm__DetectHiddenText" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current mode (On or Off) set by <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_AutoTrim</td>
<td class="calibre4 tbd"><a id="Variables.htm__AutoTrim" href="#Variables.htm__AutoTrim" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current mode (On or Off) set by <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_StringCaseSense</td>
<td class="calibre4 tbd"><a id="Variables.htm__StringCaseSense" href="#Variables.htm__StringCaseSense" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current mode (On or Off) set by <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_FormatInteger</td>
<td class="calibre4 tbd"><a id="Variables.htm__FormatInteger" href="#Variables.htm__FormatInteger" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current integer format (H or D) set by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_FormatFloat</td>
<td class="calibre4 tbd"><a id="Variables.htm__FormatFloat" href="#Variables.htm__FormatFloat" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current floating point number format set by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_KeyDelay</td>
<td class="calibre4 tbd"><a id="Variables.htm__KeyDelay" href="#Variables.htm__KeyDelay" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current delay set by <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a> (always decimal, not hex). </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_WinDelay</td>
<td class="calibre4 tbd"><a id="Variables.htm__WinDelay" href="#Variables.htm__WinDelay" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current delay set by <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a> (always decimal, not hex).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ControlDelay</td>
<td class="calibre4 tbd"><a id="Variables.htm__ControlDelay" href="#Variables.htm__ControlDelay" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current delay set by <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a> (always decimal, not hex).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_MouseDelay</td>
<td class="calibre4 tbd"><a id="Variables.htm__MouseDelay" href="#Variables.htm__MouseDelay" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current delay set by <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a> (always decimal, not hex).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_DefaultMouseSpeed</td>
<td class="calibre4 tbd"><a id="Variables.htm__DefaultMouseSpeed" href="#Variables.htm__DefaultMouseSpeed" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The current speed set by <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> (always decimal, not hex).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_IconHidden</td>
<td class="calibre4 tbd"><a id="Variables.htm__IconHidden" href="#Variables.htm__IconHidden" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Contains 1 if the tray icon is currently hidden or 0 otherwise. The icon can be hidden via <a href="#h_NoTrayIcon.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#NoTrayIcon</a> or the <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a> command.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_IconTip</td>
<td class="calibre4"><a id="Variables.htm__IconTip" href="#Variables.htm__IconTip" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Blank unless a custom tooltip for the tray icon has been specified via <em class="calibre21"><a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><em class="calibre21">Menu</em></a><em class="calibre21" />, Tray, Tip -- </em> in which case it's the text of the tip. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_IconFile</td>
<td class="calibre4"><a id="Variables.htm__IconFile" href="#Variables.htm__IconFile" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Blank unless a custom tray icon has been specified via <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><em class="calibre21">Menu</em></a><em class="calibre21">, tray, icon</em> -- in which case it's the full path and name of the icon's file.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_IconNumber</td>
<td class="calibre4 tbd"><a id="Variables.htm__IconNumber" href="#Variables.htm__IconNumber" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Blank if A_IconFile is blank. Otherwise, it's the number of the icon in A_IconFile (typically 1).</td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25">User Idle Time </h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_TimeIdle</td>
<td class="calibre4 tbd"><a id="Variables.htm__TimeIdle" href="#Variables.htm__TimeIdle" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The number of milliseconds that have elapsed since the system last received keyboard, mouse, or other input. This is useful for determining whether the user is away. This variable will be blank unless the operating system is Windows 2000, XP, or beyond. Physical input from the user as well as artificial input generated by <strong class="calibre14">any</strong> program or script (such as the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> or <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a> commands) will reset this value back to zero. Since this value tends to increase by increments of 10, do not check whether it is equal to another value. Instead, check whether it is greater or less than another value. For example: IfGreater, A_TimeIdle, 600000, MsgBox, The last keyboard or mouse activity was at least 10 minutes ago. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_TimeIdlePhysical</td>
<td class="calibre4 tbd">
<p class="calibre8"><a id="Variables.htm__TimeIdlePhysical" href="#Variables.htm__TimeIdlePhysical" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Same as above but <strong class="calibre14">ignores</strong> artificial input whenever the corresponding hook (<a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a>) is installed. If neither hook is installed, this variable is equivalent to A_TimeIdle. If only one hook is present, only that one type of artificial input will be ignored. A_TimeIdlePhysical may be more useful than A_TimeIdle for determining whether the user is truly present.</p>
</td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25">GUI Windows and Menu Bars</h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_Gui</td>
<td class="calibre4 tbd"><a id="Variables.htm__Gui" href="#Variables.htm__Gui" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI</a> window number that launched the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>. This variable is blank unless a Gui control, menu bar item, or event such as GuiClose/GuiEscape launched the current thread. [requires v1.0.23+]</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_GuiControl</td>
<td class="calibre4 tbd"><a id="Variables.htm__GuiControl" href="#Variables.htm__GuiControl" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The name of the variable associated with the GUI control that launched the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>. If that control lacks an <a href="#Gui.htm__Events" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated variable</a>, A_GuiControl instead contains the first 63 characters of the control's text/caption (this is most often used to avoid giving each button a variable name). A_GuiControl is blank whenever: 1) A_Gui is blank; 2) a GUI menu bar item or event such as GuiClose/GuiEscape launched the current thread; 3) the control lacks an associated variable and has no caption; or 4) The control that originally launched the current thread no longer exists (perhaps due to <a href="#Gui.htm__Destroy" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Destroy</a>). [requires v1.0.23+]</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_GuiWidth<br class="calibre12" /> A_GuiHeight</td>
<td class="calibre4 tbd"><a id="Variables.htm__GuiWidth" href="#Variables.htm__GuiWidth" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> These variables contain undefined/random values except when referenced in a GuiSize <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a>. See <a href="#Gui.htm__GuiSize" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiSize label</a> for details.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_GuiControlEvent</td>
<td class="calibre4 tbd">
<p class="calibre8"><a id="GuiControlEvent" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>The type of event that launched the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>. If the thread was not launched via <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI action</a>, this variable is blank. Otherwise, it contains one of the following strings:</p>
<p class="calibre8"><strong class="calibre14">Normal</strong>: The event was triggered by a single left-click or via keystrokes (arrow keys, TAB key, space bar, underlined shortcut key, etc.). This value is also used for menu bar items and the special events such as GuiClose and GuiEscape.</p>
<p class="calibre8"><strong class="calibre14">DoubleClick</strong>: The event was triggered by a double-click. Note: The first click of the click-pair will still cause a <em class="calibre21">Normal</em> event to be received first. In other words, the subroutine will be launched twice: once for the first click and again for the second.</p>
<p class="calibre8"><strong class="calibre14">RightClick</strong>: Although this feature is not yet implemented, for compatibility with future versions of AutoHotkey, you should write your scripts under the assumption that it is possible. For example, do not assume that "if A_GuiControlEvent &lt;&gt; Normal" must be a double-click. Instead, it is usually best to have the script do nothing if the value is anything other than <em class="calibre21">Normal</em> or <em class="calibre21">DoubleClick</em>.</p>
<p class="calibre8"><strong class="calibre14">Future/undetermined values</strong>: Same comment as above.</p>
<p class="calibre8"><strong class="calibre14">Slider values</strong>: See the <a href="#Gui.htm__slider" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">slider control</a> for details.</p>
<p class="calibre8">Drag-and-drop contents: See the <a href="#Gui.htm__GuiDropFiles" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiDropFiles label</a>.</p>
<p class="calibre8">Note: Unlike variables such as A_ThisHotkey, each <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> retains its own value for A_Gui, A_GuiControl, and A_GuiControlEvent. Therefore, if a thread is interrupted by another, upon being resumed it will still see its original/correct values in these variables.</p>
</td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25"><a id="Variables.htm__h" href="#Variables.htm__h" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Hotkeys, Hotstrings, and Custom Menu Items </h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_ThisMenuItem</td>
<td class="calibre4"><a id="Variables.htm__ThisMenuItem" href="#Variables.htm__ThisMenuItem" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The name of the most recently selected <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a> (blank if none). [requires v1.0.13+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ThisMenu</td>
<td class="calibre4"><a id="Variables.htm__ThisMenu" href="#Variables.htm__ThisMenu" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The name of the menu from which A_ThisMenuItem was selected.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ThisMenuItemPos</td>
<td class="calibre4"><a id="ThisMenuItemPos" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a><span class="tbd">A number indicating the <u class="calibre20">current</u> position of A_ThisMenuItem within A_ThisMenu. The first item in the menu is 1, the second is 2, and so on. Menu separator lines are counted. This variable is blank if A_ThisMenuItem is blank or no longer exists within A_ThisMenu. It is also blank if A_ThisMenu itself no longer exists. [requires v1.0.18+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ThisHotkey</td>
<td class="calibre4"><a id="Variables.htm__ThisHotkey" href="#Variables.htm__ThisHotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The key name of the most recently executed hotkey (blank if none), e.g. #z. This value will change if the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> is interrupted by another hotkey, so be sure to copy it into another variable immediately if you need the original value for later use in a subroutine.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_PriorHotkey</td>
<td class="calibre4"><a id="Variables.htm__PriorHotkey" href="#Variables.htm__PriorHotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">Same as above except for the previous hotkey. It will be blank if none. </span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_TimeSinceThisHotkey</td>
<td class="calibre4"><a id="Variables.htm__TimeSinceThisHotkey" href="#Variables.htm__TimeSinceThisHotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The number of milliseconds that have elapsed since A_ThisHotkey was pressed. It will be -1 whenever A_ThisHotkey is blank.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_TimeSincePriorHotkey</td>
<td class="calibre4"><a id="Variables.htm__TimeSincePriorHotkey" href="#Variables.htm__TimeSincePriorHotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The number of milliseconds that have elapsed since A_PriorHotkey was pressed. It will be -1 whenever A_PriorHotkey is blank.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_EndChar</td>
<td class="calibre4"><a id="Variables.htm__EndChar" href="#Variables.htm__EndChar" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The ending character that was pressed by the user to trigger the most recent <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">non-auto-replace hotstring</a>. If no ending character was required (due to the * option), this variable will be blank. [requires v1.0.17+]</td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25"><a id="Variables.htm__os" href="#Variables.htm__os" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Operating System and User Info </h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_OSType</td>
<td class="calibre4"> <a id="Variables.htm__OSType" href="#Variables.htm__OSType" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="">The type of Operating System being run.  <span class="rm">Either WIN32_WINDOWS (i.e. Win95/98/ME) or WIN32_NT (i.e. WinNT, Win2k, WinXP, and maybe some beyond those).</span></span> <span class="x11">Currently always set to Linux.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_OSVersion</td>
<td class="calibre4"> <a id="Variables.htm__OSVersion" href="#Variables.htm__OSVersion" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">One of the following strings: WIN_XP, WIN_2000, WIN_NT4, WIN_95, WIN_98, WIN_ME.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Language</td>
<td class="calibre4"><a id="Variables.htm__Language" href="#Variables.htm__Language" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">The system's default language, which is one of the strings from the <a href="#Languages.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">language table</a></span>. [requires 1.0.24+]</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ComputerName</td>
<td class="calibre4"><a id="Variables.htm__ComputerName" href="#Variables.htm__ComputerName" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The network name of the computer.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_UserName</td>
<td class="calibre4"><a id="Variables.htm__UserName" href="#Variables.htm__UserName" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The logon name of the current user.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_WinDir</td>
<td class="calibre4"><a id="Variables.htm__WinDir" href="#Variables.htm__WinDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">The windows directory (requires v1.0.23+). Example: C:\Windows</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ProgramFiles</td>
<td class="calibre4"><a id="Variables.htm__ProgramFiles" href="#Variables.htm__ProgramFiles" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">The Program Files directory (requires v1.0.23+). Example: C:\Program Files</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Desktop</td>
<td class="calibre4"><a id="Desktop" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a><span class="tbd">The full path and name of the folder containing the current user's desktop files. [requires 1.0.24+]</span> </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_DesktopCommon</td>
<td class="calibre4"><a id="DesktopCommon" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a><span class="tbd">The full path and name of the folder containing the all-users desktop files. [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_StartMenu</td>
<td class="calibre4"><a id="Variables.htm__StartMenu" href="#Variables.htm__StartMenu" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">The full path and name of the current user's Start Menu folder. [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_StartMenuCommon</td>
<td class="calibre4"><a id="Variables.htm__StartMenuCommon" href="#Variables.htm__StartMenuCommon" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">The full path and name of the all-users Start Menu folder. [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Programs</td>
<td class="calibre4"><a id="Variables.htm__Programs" href="#Variables.htm__Programs" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The full path and name of the Programs folder in the current user's Start Menu. [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_ProgramsCommon</td>
<td class="calibre4"><a id="Variables.htm__ProgramsCommon" href="#Variables.htm__ProgramsCommon" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The full path and name of the Programs folder in the all-users Start Menu. [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Startup</td>
<td class="calibre4"><a id="Variables.htm__Startup" href="#Variables.htm__Startup" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">The full path and name of the Startup folder in the current user's Start Menu. [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_StartupCommon</td>
<td class="calibre4"><a id="Variables.htm__StartupCommon" href="#Variables.htm__StartupCommon" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> <span class="tbd">The full path and name of the Startup folder in the all-users Start Menu. [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_MyDocuments</td>
<td class="calibre4"><a id="Variables.htm__MyDocuments" href="#Variables.htm__MyDocuments" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The full path and name of the current user's "My Documents" folder. Unlike most of the similar variables, if the folder is the root of a drive, the final backslash is not included. For example, it would contain M: rather than M:\ [requires 1.0.24+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_Home</td>
<td class="calibre4 x11"><a id="Variables.htm__Home" href="#Variables.htm__Home" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The full path and name of the current user's $HOME folder.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_IsAdmin</td>
<td class="calibre4"><a id="Variables.htm__IsAdmin" href="#Variables.htm__IsAdmin" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> If the current user has admin rights, this variable contains 1. Otherwise, it contains 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">
<p class="calibre8">A_ScreenWidth<br class="calibre12" /> A_ScreenHeight</p>
</td>
<td class="calibre4">
<p class="calibre8"><a id="Screen" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>The width and height of the primary monitor, in pixels (e.g. 1024 and 768).</p>
<p class="calibre8">To discover the dimensions of other monitors in a multi-monitor system, use <a href="#SysGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SysGet</a>.</p>
<p class="calibre8">To instead discover the width and height of the entire desktop (even if it spans multiple monitors), use the following example<br class="calibre12" />
<a href="#SysGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SysGet</a>, VirtualWidth, 78<br class="calibre12" />
<a href="#SysGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SysGet</a>, VirtualHeight, 79
</p>
<p class="calibre8">In addition, use <a href="#SysGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SysGet</a> to discover the work area of a monitor, which can be smaller than the monitor's total area because the taskbar and other registered desktop toolbars are excluded.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_IPAddress1 through 4 </td>
<td class="calibre4"><a id="Variables.htm__IPAddress" href="#Variables.htm__IPAddress" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The IP addresses of the first 4 network adapters in the computer. [requires v1.0.10+]</span></td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25">Misc.</h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_Cursor</td>
<td class="calibre4"><a id="Variables.htm__Cursor" href="#Variables.htm__Cursor" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><span class="tbd"> The type of mouse cursor currently being displayed. It will be one of the following words: AppStarting, Arrow, Cross, Help, IBeam, Icon, No, Size, SizeAll, SizeNESW, SizeNS, SizeNWSE, SizeWE, UpArrow, Wait, Unknown. The acronyms used with the size-type cursors are compass directions, e.g. NESW = NorthEast+SouthWest. The hand-shaped cursors (pointing and grabbing) are classfied as Unknown. [requires v1.0.10+]</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_CaretX<br class="calibre12" /> A_CaretY</td>
<td class="calibre4">
<div class="tbd">
<p class="calibre8"><a id="Caret" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>The current X and Y coordinates of the caret (text insertion point). [requires v1.0.17+] The coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> is used to make them relative to the entire screen. If there is no active window or the caret position cannot be determined, these variables are blank.</p>
<p class="calibre8">The following example script allows you to move the caret around to see its current position displayed in an auto-update tooltip. Note that some windows (e.g. certain versions of MS Word) report the same caret position regardless of its actual position.</p>
<p class="calibre8">#Persistent<br class="calibre12" /> SetTimer, WatchCaret, 100<br class="calibre12" /> return<br class="calibre12" /> WatchCaret:<br class="calibre12" /> display_y = %A_CaretY%<br class="calibre12" /> display_y -= 20 ; Move tooltip up a little so as not to hide the caret.<br class="calibre12" /> ToolTip, X%A_CaretX% Y%A_CaretY%, %A_CaretX%, %display_y%<br class="calibre12" /> return</p>
</div>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Clipboard</td>
<td class="calibre4">The contents of the OS's clipboard, which can be read or written to. See the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Clipboard</a> section.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ErrorLevel</td>
<td class="calibre4">See <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a>.</td>
</tr>
</tbody>
</table>
<br class="calibre12" /><br class="calibre12" />
<h4 class="calibre25"><a id="Variables.htm__loop" href="#Variables.htm__loop" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Loop</h4>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_Index</td>
<td class="calibre4"><a id="Variables.htm__Index" href="#Variables.htm__Index" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> This is the number of the current loop iteration. For example, the first time the script executes the body of a loop, this variable will contain the number 1. See <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a> for details.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileName, etc. </td>
<td class="calibre4"><span class="">This and other related variables are valid only inside a <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-loop</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4 rm">A_LoopRegName, etc. </td>
<td class="calibre4"><span class="rm">This and other related variables are valid only inside a <a href="#LoopReg.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">registry-loop</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopReadLine</td>
<td class="calibre4"><span class="">See <a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-read loop</a>. </span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopField</td>
<td class="calibre4">See <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a>.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="LastFoundWindow.htm" href="#LastFoundWindow.htm">#</a>
<h2 class="calibre9"><span class="calibre23">The "Last Found" Window </span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">This is the window most recently found by <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWin[Not]Exist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWin[Not]Active</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait[Not]Active</a>, or <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>. It can make scripts easier to create and maintain since the WinTitle and WinText of the target window do not need to be repeated for every windowing command. In addition, scripts perform better because they don't need to search for the target window again after it's been found the first time.</p>
<p class="calibre8">The "last found" window can be used by all of the windowing commands except <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinActivateBottom.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivateBottom</a>, and <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>. To use it, simply omit all four window parameters (WinTitle, WinText, ExcludeTitle, and ExcludeText).</p>
<p class="calibre8">Each <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> retains its own value of the "last found" window, meaning that if the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> is interrupted by another, when the original thread is resumed it will still have its original value of of the "last found" window, not that of the interrupting thread.</p>
<p class="calibre8"> </p>
<p class="calibre8">Related Notes:</p>
<ul class="calibre10">
<li class="calibre11">If multiple windows match the WinTitle/Text criteria of a windowing command such as <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>, the most recently active window is used.</li>
<li class="calibre11">Almost all of the windowing commands can be told to operate upon the active window by specifying the letter A as the WinTitle parameter and omitting WinText, ExcludeTitle, and ExcludeText.</li>
<li class="calibre11">In v1.0.09+, all windowing commands can operate upon a class of windows by specifying for WinTitle the class text shown by Window Spy or retrieved by <a href="#WinGetClass.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetClass</a>. </li>
<li class="calibre11">In v1.0.12+, all windowing commands can operate upon a specific window via its unique ID number, which is retrieved by <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>.<br class="calibre12" />
</li>
</ul>
<strong class="calibre14">Examples</strong>
<pre class="calibre22">IfWinExist, Untitled - Notepad
{
WinActivate ; Automatically uses the window found above.
WinMaximize ; same
Send, Some text.{Enter}
return
}
IfWinNotExist, Calculator
return
else
{
WinActivate ; The above "IfWinNotExist" also set the "last found" window for us.
WinMove, 40, 40 ; Move it to a new position.
return
}
; Make a hotkey to maximize a window.
; Specify just "A" to make it operate on the active window:
^Up::WinMaximize, A
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="commands.htm" href="#commands.htm">#</a>
<p class="calibre8"><span class="calibre17">AutoHotkey Command List</span> -- Click on a command name for details.</p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" height="3488" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td height="16" width="25%" class="calibre26"><span class="calibre27"><strong class="calibre14">Command</strong></span></td>
<td height="16" width="75%" class="calibre26"><span class="calibre27"><strong class="calibre14">Description</strong></span></td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">{ ... }</a></td>
<td height="16" class="calibre4">Denotes a block. Blocks are typically used with <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a>, <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, and IF-commands.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a></td>
<td height="16" class="calibre4">Determines whether <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv and "var = value"</a> statements remove spaces and tabs.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a></td>
<td height="16" class="calibre4">Disables or enables the user's ability to interact with the computer via keyboard, mouse, and perhaps other input devices. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a></td>
<td height="16" class="calibre4">Exits (terminates) a <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a>. Valid only inside a <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ClipWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ClipWait</a></td>
<td height="16" class="calibre4">Waits until the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard</a> contains text or files.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a></td>
<td height="16" class="calibre4">Skips the rest of the current <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a> iteration and begins a new one. Valid only inside a <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a></td>
<td height="16" class="calibre4">Makes a variety of changes to a control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a></td>
<td height="16" class="calibre4">Sends a mouse button or mouse wheel event to a control. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a></td>
<td height="16" class="calibre4">Sets input focus to a given control on a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a></td>
<td height="16" class="calibre4">Retrieves various types of information about a control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ControlGetFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetFocus</a></td>
<td height="16" class="calibre4">Retrieves which control of the target window has input focus, if any.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a></td>
<td height="16" class="calibre4">Retrieves the position and size of a control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a></td>
<td height="16" class="calibre4">Retrieves text from a control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a></td>
<td height="16" class="calibre4">Moves or resizes a control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend / ControlSendRaw </a></td>
<td height="16" class="calibre4">Sends simulated keystrokes to a window or control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a></td>
<td height="16" class="calibre4">Changes the text of a control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a></td>
<td height="16" class="calibre4">Sets coordinate mode for various commands to be either relative or screen.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a></td>
<td height="16" class="calibre4">Determines whether invisible text in a window is "seen" for the purpose of finding the window. This affects commands such as IfWinExist and WinActivate.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a></td>
<td height="16" class="calibre4">Determines whether invisible windows are "seen" by the script.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Drive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Drive</a></td>
<td height="16" class="calibre4">Ejects/retracts the tray in a CD or DVD drive, or sets a drive's volume label. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#DriveGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveGet</a></td>
<td height="16" class="calibre4">Retrieves various types of information about the computer's drive(s).</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#DriveSpaceFree.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveSpaceFree</a></td>
<td height="16" class="calibre4">Retrieves the free disk space of a drive, in Megabytes.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Edit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Edit</a></td>
<td height="16" class="calibre4">Opens the current script for editing in the associated editor. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a></td>
<td height="16" class="calibre4">Specifies the command(s) to perform if an IF-command evaluates to FALSE.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a></td>
<td height="16" class="calibre4">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to the sum of itself plus the given value (can also add or subtract time from a <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">date-time</a> value). Synonymous with: var += value</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#EnvDiv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvDiv</a></td>
<td height="16" class="calibre4">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to itself divided by the given value. Synonymous with: var /= value</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#EnvMult.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvMult</a></td>
<td height="16" class="calibre4">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to itself times the given value. Synonymous with: var *= value</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a></td>
<td height="16" class="calibre4">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to itself minus the given value (can also compare <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">date-time</a> values). Synonymous with: var -= value</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a></td>
<td height="16" class="calibre4">Exits the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> or (if the script is not <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a> contains no hotkeys) the entire script.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a></td>
<td height="16" class="calibre4">Terminates the script unconditionally. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a></td>
<td height="16" class="calibre4">Appends text to a text file.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a></td>
<td height="16" class="calibre4">Copies one or more files.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileCopyDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopyDir</a></td>
<td height="16" class="calibre4"> Copies a directory and all sub-directories and files (similar to xcopy).</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileCreateDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCreateDir</a></td>
<td height="16" class="calibre4">Creates a directory/folder.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileCreateShortcut.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCreateShortcut</a></td>
<td height="16" class="calibre4">Creates a shortcut (.lnk) file.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a></td>
<td height="16" class="calibre4">Deletes one or more files.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileInstall.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileInstall</a></td>
<td height="16" class="calibre4">Includes the specified file inside the compiled script (Ahk2Exe).</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileReadLine.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileReadLine</a></td>
<td height="16" class="calibre4">Reads the specified line from a file and stores the text in a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4 x11"><a href="#FileRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRead</a></td>
<td height="16" class="calibre4">Reads the specified line from a file and stores the text in a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileGetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetAttrib</a></td>
<td height="16" class="calibre4">Retrieves a code string representing a file or folder's attributes.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileGetShortcut.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetShortcut</a></td>
<td height="16" class="calibre4">Retrieves information about a shortcut (.lnk) file, such as its target file. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileGetSize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetSize</a></td>
<td height="16" class="calibre4">Retrieves the size of a file in bytes, KB, or MB. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a></td>
<td height="16" class="calibre4">Retrieves the datetime stamp of a file or folder.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileGetVersion.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetVersion</a></td>
<td height="16" class="calibre4">Retrieves the version of a file. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a></td>
<td height="16" class="calibre4">Moves or renames one or more files.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a></td>
<td height="16" class="calibre4"> Moves a directory and all sub-directories and files. It can also rename a directory.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileRecycle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycle</a></td>
<td height="16" class="calibre4">Sends a file or directory to the recycle bin, if possible.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileRecycleEmpty.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycleEmpty</a></td>
<td height="16" class="calibre4">Empties the recycle bin.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FileRemoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRemoveDir</a></td>
<td height="16" class="calibre4">Deletes a directory/folder.</td>
</tr>
<tr class="calibre3">
<td height="14" class="calibre4"><a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a></td>
<td height="14" class="calibre4">Displays a standard dialog that allows the user to select file(s).</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a></td>
<td height="16" class="calibre4">
<p class="calibre8">Displays a standard dialog that allows the user to select a folder.</p>
</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a></td>
<td height="16" class="calibre4">Changes the attributes of one or more files or folders. Wildcards are supported.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a></td>
<td height="16" class="calibre4">Changes the datetime stamp of one or more files or folders. Wildcards are supported.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#FormatTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FormatTime</a></td>
<td height="16" class="calibre4">Transforms a <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> timestamp into the specified date/time format.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a></td>
<td height="16" class="calibre4">Checks if a keyboard key or mouse/joystick button is down or up. Also retrieves joystick status.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a></td>
<td height="16" class="calibre4">Jumps to the specified label and continues execution until <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a> is encountered.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Goto</a></td>
<td height="16" class="calibre4">Jumps to the specified label and continues execution.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a></td>
<td height="16" class="calibre4">Activates the next window in a window group that was defined with <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a></td>
<td height="16" class="calibre4">Adds a window specification to a window group, creating the group if necessary. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a></td>
<td height="16" class="calibre4">Closes the active window if it was just activated by <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> or <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>. It then activates the next window in the series. It can also close all windows in a group. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a></td>
<td height="16" class="calibre4">Similar to <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> except activates the next window <strong class="calibre14">not</strong> in the group.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a></td>
<td height="16" class="calibre4">Creates and manages windows and controls. Such windows can be used as data entry forms or custom user interfaces.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a></td>
<td height="16" class="calibre4">Makes a variety of changes to a control in a GUI window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a></td>
<td height="16" class="calibre4">Retrieves various types of information about a control in a GUI window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Hotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a></td>
<td height="16" class="calibre4">Creates, modifies, enables, or disables a hotkey while the script is running.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If</a></td>
<td height="16" class="calibre4">Compares a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to a value.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var [not] between</a></td>
<td height="16" class="calibre4">Checks whether a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable's</a> contents are numerically or alphabetically between two values (inclusive).</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfIn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var [not] in/contains MatchList </a></td>
<td height="16" class="calibre4">Checks whether a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable's</a> contents match one of the items in a list.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var is [not] type</a></td>
<td height="16" class="calibre4">Checks whether a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable's</a> contents are numeric, uppercase, etc. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual/IfNotEqual</a><br class="calibre12" />
</td>
<td height="16" class="calibre4">Compares a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to a value for equality. Synonymous with: if var = value ... if var &lt;&gt; value</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfExist/IfNotExist</a><br class="calibre12" /></td>
<td height="16" class="calibre4">Checks for the existence of a file or directory.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfGreater/IfGreaterOrEqual</a><br class="calibre12" /></td>
<td height="16" class="calibre4">Compares a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to a value. Synonymous with: if var &gt; value | if var &gt;= value</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString/IfNotInString</a><br class="calibre12" /></td>
<td height="16" class="calibre4">Checks if a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> contains the specified string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfLess/IfLessOrEqual</a><br class="calibre12" /></td>
<td height="16" class="calibre4">Compares a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to a value. Synonymous with: if var &lt; value | if var &lt;= value</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfMsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfMsgBox</a><br class="calibre12" /></td>
<td height="16" class="calibre4">Checks which button was pushed by the user during the most recent <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> command.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive/IfWinNotActive</a><br class="calibre12" /></td>
<td height="16" class="calibre4"> Checks to see if a specified window exists and is currently active (foreground).</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist/IfWinNotExist</a><br class="calibre12" /></td>
<td height="16" class="calibre4"> Checks to see if a specified window exists. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IniDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniDelete</a></td>
<td height="16" class="calibre4">Deletes a value from a standard format .ini file.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IniRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniRead</a></td>
<td height="16" class="calibre4">Reads a value from a standard format .ini file.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a></td>
<td height="16" class="calibre4">Writes a value to a standard format .ini file.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Input.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Input</a></td>
<td height="16" class="calibre4">Waits for the user to type a string (not supported on Windows 9x).</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a></td>
<td height="16" class="calibre4">Displays an input box to ask the user to enter a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a></td>
<td height="16" class="calibre4">Displays script info and a history of the 20 most recent keystrokes and mouse clicks.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#KeyWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyWait</a></td>
<td height="16" class="calibre4">Waits for a key or mouse/joystick button to be released or pressed down.</td>
</tr>
<tr class="calibre3 rm">
<td height="16" class="calibre4">LeftClick</td>
<td height="16" class="calibre4">[Obsolete -- use <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a> for greater flexibility]</td>
</tr>
<tr class="calibre3 rm">
<td height="16" class="calibre4">LeftClickDrag</td>
<td height="16" class="calibre4"> [Obsolete -- use <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a> for greater flexibility]</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a></td>
<td height="16" class="calibre4">Displays the hotkeys in use by the current script, whether their subroutines are currently running, and whether or not they use the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hook.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a></td>
<td height="16" class="calibre4">Displays the script lines most recently executed. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#ListVars.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListVars</a></td>
<td height="16" class="calibre4">Displays the script's <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variables</a>: their names and current contents.</td>
</tr>
<tr class="calibre3">
<td height="16" class="x11 calibre4"><a href="#EnvGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvGet</a></td>
<td height="16" class="calibre4">Retrieves an environment variable.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop (normal) </a></td>
<td height="16" class="calibre4">Perform a series of command repeatedly: either the specified number of times or until <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> is encountered. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop (files &amp; folders)</a> </td>
<td height="16" class="calibre4">Retrieves the specified files or folders, one at a time.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop (parse a string) </a></td>
<td height="16" class="calibre4">Retrieves substrings (fields) from a string, one by one.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop (read file contents)</a> </td>
<td height="16" class="calibre4">Retrieves the lines in a text file, one by one (performs better than <a href="#FileReadLine.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileReadLine</a>). </td>
</tr>
<tr class="calibre3 rm">
<td height="16" class="calibre4"><a href="#LoopReg.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop (registry)</a></td>
<td height="16" class="calibre4">Retrieves the contents of the specified registry subkey, one item at a time. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a></td>
<td height="16" class="calibre4">Creates, deletes, modifies and displays menus and menu items. Changes the tray icon and its tooltip. Controls whether the main window of a compiled script can be opened. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a></td>
<td height="16" class="calibre4">Clicks or holds a mouse button, or turns the mouse wheel.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a></td>
<td height="16" class="calibre4">Clicks and holds the specified mouse button, moves the mouse to the destination coordinates, then releases the button.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a></td>
<td height="16" class="calibre4">Retrieves the current position of the mouse cursor, and optionally which window and control it is hovering over.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a></td>
<td height="16" class="calibre4">Moves the mouse cursor.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a></td>
<td height="16" class="calibre4">Displays a simple message box with one or more buttons and with optional timeout.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a></td>
<td height="16" class="calibre4">Specifies a subroutine to run when the script exits.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Pause</a></td>
<td height="16" class="calibre4">Pauses the script's <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#PixelGetColor.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelGetColor</a></td>
<td height="16" class="calibre4">Retrieves the color of the pixel at the specified x,y screen coordinates.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#PixelSearch.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelSearch</a></td>
<td height="16" class="calibre4">Searches a region of the screen for a pixel of the specified color(s).</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a></td>
<td height="16" class="calibre4">Performs one of the following operations on a process: checks if it exists; changes its priority; closes it; waits for it to close.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a></td>
<td height="16" class="calibre4">Creates or modifies a window to display a progress bar.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Random.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Random</a></td>
<td height="16" class="calibre4">Generates a pseudo-random number.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a></td>
<td height="16" class="calibre4">Replaces the currently running instance of the script with a new one.</td>
</tr>
<tr class="calibre3 rm">
<td height="16" class="calibre4">Repeat…EndRepeat<br class="calibre12" /></td>
<td height="16" class="calibre4">[Obsolete -- use <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a> for greater flexibility]</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a></td>
<td height="16" class="calibre4">Returns from a subroutine to which execution had previously jumped via <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a> activation, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, or other means. </td>
</tr>
<tr class="calibre3 rm">
<td height="16" class="calibre4">RightClick</td>
<td height="16" class="calibre4">[Obsolete -- use <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a> for greater flexibility]</td>
</tr>
<tr class="calibre3 rm">
<td height="16" class="calibre4">RightClickDrag</td>
<td height="16" class="calibre4"> [Obsolete -- use <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a> for greater flexibility]</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a></td>
<td height="16" class="calibre4">Runs an external program.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#RunAs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunAs</a></td>
<td height="16" class="calibre4">Specifies a set of user credentials to use for all subsequent uses of <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> and <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a>. 2000/XP or later ONLY.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a></td>
<td height="16" class="calibre4">Runs an external program and waits until it finishes.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send / SendRaw </a></td>
<td height="16" class="calibre4">Sends simulated keystrokes to the active window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a></td>
<td height="16" class="calibre4">Determines how fast a script will run (affects CPU utilization).</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetNumScrollCapsLockState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetCapslockState</a></td>
<td height="16" class="calibre4">Sets the state of the Capslock key. Can also force the key to stay on or off. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a></td>
<td height="16" class="calibre4">Sets the delay that will occur after each Control-modifying command.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a></td>
<td height="16" class="calibre4">Sets the mouse speed that will be used if unspecified in <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Mouse</a><a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Move</a>/<a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Click</a>/<a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Drag</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a></td>
<td height="16" class="calibre4">Assigns the specified value to a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>. Synonymous with: var = value </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a></td>
<td height="16" class="calibre4">Sets the format of integers and floating point numbers generated by math operations.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a></td>
<td height="16" class="calibre4">Sets the delay that will occur after each keystroke sent by <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> or <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a></td>
<td height="16" class="calibre4">Sets the delay that will occur after each mouse movement or click.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetNumScrollCapsLockState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetNumlockState</a></td>
<td height="16" class="calibre4">Sets the state of the Numlock key. Can also force the key to stay on or off.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetNumScrollCapsLockState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetScrollLockState</a></td>
<td height="16" class="calibre4">Sets the state of the Scrolllock key. Can also force the key to stay on or off.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetStoreCapslockMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetStoreCapslockMode</a><br class="calibre12" /></td>
<td height="16" class="calibre4"> Whether to restore the state of CapsLock after a <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a></td>
<td height="16" class="calibre4">Causes a subroutine to be launched automatically and repeatedly at a specified time interval.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a></td>
<td height="16" class="calibre4">Determines how window titles are searched for by various commands. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a></td>
<td height="16" class="calibre4">Sets the delay that will occur after each windowing command.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#SetWorkingDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWorkingDir</a></td>
<td height="16" class="calibre4">Changes the script's current working directory. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Shutdown.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Shutdown</a></td>
<td height="16" class="calibre4">Shuts down, restarts, or logs off the system.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Sleep.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sleep</a></td>
<td height="16" class="calibre4">Waits the specified amount of time before continuing. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a></td>
<td height="16" class="calibre4">Arranges a variable's contents in alphabetical or numerical order.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a></td>
<td height="16" class="calibre4">Retrieves various settings from a sound device (master mute, master volume, etc.)</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SoundGetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGetWaveVolume</a></td>
<td height="16" class="calibre4">Retrieves the wave output volume from a sound device.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SoundPlay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundPlay</a></td>
<td height="16" class="calibre4">Play a sound, video, or other supported file type. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a></td>
<td height="16" class="calibre4">Changes various settings of a sound device (master mute, master volume, etc.)</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SoundSetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSetWaveVolume</a></td>
<td height="16" class="calibre4">Changes the wave output volume for a sound device. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashImage</a></td>
<td height="16" class="calibre4">Creates or modifies a window to display a JPG, GIF, or BMP image.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SplashTextOn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashTextOn</a></td>
<td height="16" class="calibre4">Creates a customizable text popup window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SplashTextOn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashTextOff</a></td>
<td height="16" class="calibre4">Closes the above window. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a></td>
<td height="16" class="calibre4">Separates a file name into its name, directory, extension, and drive.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#StatusBarGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StatusBarGetText</a></td>
<td height="16" class="calibre4">Retrieves the text from a standard status bar control.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#StatusBarWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StatusBarWait</a></td>
<td height="16" class="calibre4">Waits until a window's status bar contains the specified string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a></td>
<td height="16" class="calibre4">Determines whether string comparisons are case sensitive (default = no). </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a></td>
<td height="16" class="calibre4">Retrieves the position of the specified substring within a string.</td>
</tr>
<tr class="calibre3 x11">
<td height="16" class="calibre4"><a href="#RegExStringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegExStringGetPos</a></td>
<td height="16" class="calibre4">Retrieves the position of the specified substring within a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a></td>
<td height="16" class="calibre4">Retrieves a number of characters from the left hand side of a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a></td>
<td height="16" class="calibre4">Retrieves the count of how many characters are in a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a></td>
<td height="16" class="calibre4">Converts a string to lowercase.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a></td>
<td height="16" class="calibre4">Retrieves a number of characters from the specified position in a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a></td>
<td height="16" class="calibre4">Replaces the specified substring with a new string. </td>
</tr>
<tr class="calibre3 x11">
<td height="16" class="calibre4"><a href="#RegExReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegExReplace</a></td>
<td height="16" class="calibre4">Replaces the specified regular expression substring with a new string. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a></td>
<td height="16" class="calibre4">Retrieves a number of characters from the right hand side of a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a></td>
<td height="16" class="calibre4">Separates a string into an array of substrings using the specified delimiters.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a></td>
<td height="16" class="calibre4">Removes a number of characters from the left hand side of a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a></td>
<td height="16" class="calibre4">Removes a number of characters from the right hand side of a string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a></td>
<td height="16" class="calibre4">Converts a string to uppercase.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Suspend</a></td>
<td height="16" class="calibre4">Disables all or selected <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#SysGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SysGet</a></td>
<td height="16" class="calibre4">Retrieves screen resolution, multi-monitor info, dimensions of system objects, and other system properties.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Thread.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Thread</a></td>
<td height="16" class="calibre4">Sets the priority or interruptibility <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a></td>
<td height="16" class="calibre4">Creates an always-on-top window anywhere on the screen.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#Transform.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Transform</a></td>
<td height="16" class="calibre4">Performs miscellaneous math functions and tasks such as ASCII/Unicode conversion and bitwise operations.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#TrayTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">TrayTip</a></td>
<td height="16" class="calibre4">Creates a balloon message window near the tray icon (requires Windows 2000/XP+).</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#URLDownloadToFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">URLDownloadToFile</a></td>
<td height="16" class="calibre4">Downloads a file from the Internet. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a></td>
<td height="16" class="calibre4">Activates (brings to the foreground) a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinActivateBottom.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivateBottom</a></td>
<td height="16" class="calibre4">Same as <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a> except it activates the least recently used (bottommost) matching window rather than the newest.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a></td>
<td height="16" class="calibre4">Closes a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinGetActiveStats.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveStats</a></td>
<td height="16" class="calibre4">Combines the functions of <a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a> and <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a> into one command. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a></td>
<td height="16" class="calibre4">Retrieves the title of the active window. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinGetClass.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetClass</a></td>
<td height="16" class="calibre4">Retrieves a window's class name.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a></td>
<td height="16" class="calibre4">Retrieves a window's unique ID, process ID/name, or a list of its controls. It can also find all windows of a certain class, title, or text.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a></td>
<td height="16" class="calibre4">Retrieves the position and size of a given window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a></td>
<td height="16" class="calibre4">Retrieves the text from a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a></td>
<td height="16" class="calibre4">Retrieves the full title from a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinHide.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinHide</a></td>
<td height="16" class="calibre4">Hides a window. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinKill.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinKill</a></td>
<td height="16" class="calibre4">Forces a window to close.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinMaximize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMaximize</a></td>
<td height="16" class="calibre4">Enlarges a window to its maximum size. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinMenuSelectItem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMenuSelectItem</a></td>
<td height="16" class="calibre4">Invokes a menu item from the menu bar of a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinMinimize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimize</a></td>
<td height="16" class="calibre4">Collapses a window into a button on the task bar. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinMinimizeAll.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimizeAll</a></td>
<td height="16" class="calibre4">Minimizes all windows.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinMinimizeAll.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> WinMinimizeAllUndo</a></td>
<td height="16" class="calibre4">Undoes a previous <a href="#WinMinimizeAll.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimizeAll</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a></td>
<td height="16" class="calibre4">Changes the position and (optionally) the size of a window. </td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a></td>
<td height="16" class="calibre4">Unminimizes or unmaximizes a window if it is minimized or maximized.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a></td>
<td height="16" class="calibre4">Makes a window "always on top" and/or transparent.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinSetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSetTitle</a></td>
<td height="16" class="calibre4">Changes the title of a window.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a></td>
<td height="16" class="calibre4">Unhides a hidden window. </td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a></td>
<td height="16" class="calibre4">Waits until the requested window exists.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a></td>
<td height="16" class="calibre4">Waits until the requested window is active.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a></td>
<td height="16" class="calibre4">Waits until the requested window does not exist.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitNotActive</a></td>
<td height="16" class="calibre4">Waits until the requested window is not active.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_CommentFlag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#CommentFlag</a></td>
<td height="16" class="calibre4">Changes the script's comment symbol from semicolon to some other string.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_ErrorStdOut.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#ErrorStdOut</a></td>
<td height="16" class="calibre4">Sends any syntax error that prevents a script from launching to stdout rather than displaying a dialog.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#EscapeChar</a></td>
<td height="16" class="calibre4">Changes the script's escape character (for example: accent vs. backslash).</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#HotkeyInterval</a></td>
<td height="16" class="calibre4">Along with <a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a>, specifies the rate of <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> activations beyond which a warning dialog will be displayed.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_HotkeyModifierTimeout.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#HotkeyModifierTimeout</a></td>
<td height="16" class="calibre4">Affects the behavior of <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> modifiers: CTRL, ALT, WIN, and SHIFT.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#h_Hotstring.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Hotstring</a></td>
<td height="16" class="calibre4">Changing <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstring</a> options or ending characters.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#h_Include.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Include</a></td>
<td height="16" class="calibre4">Causes the script to behave as though the specified file's contents are present.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a></td>
<td height="16" class="calibre4">Along with <a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">HotkeyInterval</a>, specifies the rate of hotkey activations beyond which a warning dialog will be displayed.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a></td>
<td height="16" class="calibre4">Sets the the maximum capacity of each <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to the specified number of megabytes.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a></td>
<td height="16" class="calibre4">Sets the maximum number of simultaneous <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a></td>
<td height="16" class="calibre4">Causes some or all <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a> to buffer rather than ignore keypresses when their <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a> limit has been reached.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a></td>
<td height="16" class="calibre4">Sets the maximum number of simultaneous <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> per <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_NoTrayIcon.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#NoTrayIcon</a></td>
<td height="16" class="calibre4">Disables the showing of a tray icon.</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a></td>
<td height="16" class="calibre4">Keeps a non-hotkey script permanently running (that is, until <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> is encountered).</td>
</tr>
<tr class="calibre3">
<td height="16" class="calibre4"><a href="#h_SingleInstance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#SingleInstance</a></td>
<td height="16" class="calibre4">Prevents more than one instance of a script from existing simultaneously.</td>
</tr>
<tr class="calibre3">
<td height="16" class="tbd calibre4"><a href="#h_WinActivateForce.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#WinActivateForce</a></td>
<td height="16" class="calibre4">Skips the gentle method of of activating a window and goes straight to the forceful method. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ClipWait.htm" href="#ClipWait.htm">#</a> <h2 class="calibre17">ClipWait</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits until the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard</a> contains text or files.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ClipWait [, SecondsToWait]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">SecondsToWait</td>
<td width="85%" class="calibre4">If omitted, the command will wait indefinitely. Otherwise, it will wait no longer than this many seconds (can contain a decimal point). Specifying 0 is the same as specifying 0.5.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8">If the wait period expires, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to 1. Otherwise (i.e. the clipboard contains text), ErrorLevel is set to 0. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">It's better to use this command than a loop of your own that checks to see if this clipboard is blank. This is because the clipboard is never opened by this command, and thus it performs better and avoids any chance of interfering with another application that may be using the clipboard.</p>
<p class="calibre8">This command considers anything convertible to text (e.g. HTML) to be text. It also considers files, such as those copied in an Explorer window via Control-C, to be text. Such files are automatically converted to their filenames (with full path) whenever the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard</a> variable (%clipboard%) is referred to in the script.</p>
<p class="calibre8">While the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Clipboard</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#KeyWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyWait</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">clipboard = ; Empty the clipboard
Send, ^c
ClipWait, 2
if ErrorLevel &lt;&gt; 0
{
MsgBox, The attempt to copy text onto the clipboard failed.
return
}
MsgBox, clipboard = %clipboard%
return</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="EnvSet.htm" href="#EnvSet.htm">#</a> <h2 class="calibre17">EnvSet</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Writes a value to a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> contained in the environment.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">EnvSet, EnvVar, Value </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">EnvVar</td>
<td width="85%" class="calibre4">Name of the <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable</a> to use, e.g. "COMSPEC" or "PATH".</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Value</td>
<td class="calibre4">Value to set the <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable</a> to.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> This command exists separately from <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a> because unlike AutoIt2, AutoHotkey does not store its variables in the environment. This is because performance would be worse and also because the OS limits environment variables to 32K (AutoHotkey variables, including the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard</a>, are essentially unlimited in size).</p>
<p class="calibre8">Unless <a href="#EnvUpdate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvUpdate</a> is used, an <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable</a> set in this way will only be accessible to programs that the script spawns via <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> or <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a>.  Once the script terminates, the variables will cease to exist.</p>
<p class="calibre8">Note: An EnvGet command is not provided because referencing a blank or undefined variable will automatically trigger that behavior. For example, in the following line, the value of the ProgramFiles variable (if undefined in the script) will be fetched from the environment: <br class="calibre12" /> TargetFile = %ProgramFiles%\Something\setup.ini </p>
<p class="calibre8 x11">Use this to export variables to be accessed by sub processes spawned by Run / RunWait.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvUpdate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvUpdate</a>, <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a>, <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a>, <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> EnvSet, AutGUI, Some text to put in the variable. <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="EnvUpdate.htm" href="#EnvUpdate.htm">#</a> <h2 class="calibre17">EnvUpdate</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Notifies the OS and all running applications that <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable(s)</a> have changed.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">EnvUpdate </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> Refreshes the OS environment. Similar effect as logging off and then on again.</p>
<p class="calibre8">For example, after making changes to the following registry key on Windows NT/2000/XP, EnvUpdate could be used to broadcast the change: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session <br class="calibre12" /> Manager\Environment</p>
<p class="calibre8">Due to the nature of this feature, there is a slight chance that keyboard and mouse events will lag (be delayed) while the command is running if the keyboard/mouse hooks are installed.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSet</a>, <a href="#RegWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegWrite</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> EnvUpdate<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Drive.htm" href="#Drive.htm">#</a> <h2 class="calibre17">Drive</h2> [v1.0.22+]
<hr size="2" class="calibre24" />
<p class="calibre8">Ejects/retracts the tray in a CD or DVD drive, or sets a drive's volume label. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Drive, Sub-command [, Drive , Value]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8">The sub-command, drive, and value parameters are dependent upon each other and their usage is described below.</p>
<p class="calibre8"><strong class="calibre14">Label, Drive [, NewLabel]</strong>: Changes <em class="calibre21">Drive</em>'s volume label to be <em class="calibre21">NewLabel</em> (if <em class="calibre21">NewLabel</em> is omitted, the drive will have no label). <em class="calibre21">Drive</em> is the drive letter followed by a colon and an optional backslash (might also work on UNCs and mapped drives). Example: Drive, Label, C:, Seagate200</p>
<p class="calibre8">To retrieve the current label, follow this example: <a href="#DriveGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveGet</a>, OutputVar, Label, C:</p>
<p class="calibre8"><strong class="calibre14"> Lock, Drive</strong> [v1.0.24+]: Prevents a drive's eject feature from working until the script or another program unlocks it, or the system is restarted. Example: "Drive, Lock, D:". Most drives cannot be "locked open". However, locking the drive while it is open will probably result in it becoming locked the moment it is closed. This command has no effect on drives that do not support locking (such as most read-only drives), nor is it likely to work on non-IDE drives on Windows 95/98/Me. If a drive is locked by a script and that script exits, the drive will stay locked until another script or program unlocks it, or the system is restarted. If the specified drive does not exist or does not support the locking feature, ErrorLevel is set to 1. Otherwise, it is set to 0.</p>
<p class="calibre8"><br class="calibre12" />
<strong class="calibre14">Unlock, Drive</strong> [v1.0.24+]: Reverses the above. On Window NT/2000/XP or later, <em class="calibre21">Unlock</em> needs to be executed multiple times if the drive was locked multiple times (at least for some drives). For example, if "Drive, Lock, D:" was executed three times, three executions of "Drive, Unlock, D:" might be needed to unlock it. Because of this and the fact that there is no way to determine whether a drive is currently locked, it is often useful to keep track of its lock-state in a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>.
</p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" /> Eject [, Drive, 1]</strong>: Ejects or retracts the tray of a CD or DVD drive (if <em class="calibre21">Drive</em> is omitted, the default CD/DVD drive will be used). To eject the tray, omit the last parameter. To retract/close the tray, specify 1 for the last parameter. Example for retraction: Drive, Eject, D:, 1</p>
<p class="calibre8">If the tray is already in the correct state (open or closed), <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0 (i.e. "no error"). This command will probably not work on a network drive or non-CD/DVD drive; if it fails in such cases or for any other reason, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1.</p>
<p class="calibre8">It may be possible to detect the previous tray state by measuring the time the command takes to complete. For example, to toggle the tray to the opposite state (open or closed), try using a hotkey such as the following:</p> #c::<br class="calibre12" /> Drive, Eject<br class="calibre12" /> ; If the command completed quickly, the tray was probably already ejected.<br class="calibre12" /> ; In that case, retract it:<br class="calibre12" /> if A_TimeSinceThisHotkey &lt; 1000 ; Adjust this time if needed. <br class="calibre12" />      Drive, Eject,, 1<br class="calibre12" /> return <p class="calibre8">This command waits for the ejection or retraction to complete before allowing the script to continue. In addition, due to the nature of this command, there might be some keyboard or mouse lag (reduced responsiveness) during the operation if the script executing it has the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> and/or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hooks installed. This limitation will be resolved in a future release, if possible.</p>
<p class="calibre8">To determine the media status of a CD or DVD drive (playing, stopped, open, etc.), see <a href="#DriveGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveGet</a>. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 of there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">None.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#DriveGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveGet</a>, <a href="#DriveSpaceFree.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveSpaceFree</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Drive, Label, D:, BackupDrive</p>
<p class="calibre8">Drive, Eject,, 1 ; Retract (close) the tray of the default CD or DVD drive. </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="DriveGet.htm" href="#DriveGet.htm">#</a> <h2 class="calibre17">DriveGet</h2> [v1.0.10+]
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves various types of information about the computer's drive(s). </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">DriveGet, OutputVar, Cmd [, Value]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of the variable in which to store the result of <em class="calibre21">Cmd</em>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Cmd, Value</td>
<td class="calibre4">See list below. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14"><u class="calibre20">Cmd, Value</u></strong></p>
<p class="calibre8">The <em class="calibre21">Cmd</em> and <em class="calibre21">Value</em> parameters are dependent upon each other and their usage is described below. If a problem is encountered <em class="calibre21">OutputVar</em> is made blank and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1.</p>
<p class="calibre8"><strong class="calibre14">List [, Type] </strong>: Sets <em class="calibre21">OutputVar</em> to be a string of letters, one character for each drive letter in the system. Example: ACDEZ. If <em class="calibre21">Type</em> is omitted, all drive types are retrieved. Otherwise, <em class="calibre21">Type</em> should be one of the following words to retrieve only a specific type of drive: CDROM, REMOVABLE, FIXED, NETWORK, RAMDISK, UNKNOWN.</p>
<p class="calibre8"><strong class="calibre14">Capacity (or Cap), Path</strong>: Retrieves the total capacity of <em class="calibre21">Path</em> (e.g. C:\) in megabytes. Use <a href="#DriveSpaceFree.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveSpaceFree</a> to determine the free space. </p>
<p class="calibre8"><strong class="calibre14">Filesystem (or FS), Drive </strong>: Retrieves the type of <em class="calibre21">Drive</em>'s file system, where <em class="calibre21">Drive</em> is the drive letter followed by a colon and an optional backslash, or a UNC name such \\server1\share1. <em class="calibre21">OutputVar</em> will be set to one of the following words: FAT, FAT32, NTFS, CDFS (typically indicates a CD), UDF (typically indicates a DVD). <em class="calibre21">OutputVar</em> will be made blank and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> set to 1 if the drive does not contain formatted media.</p>
<p class="calibre8"><strong class="calibre14">Label, Drive</strong>: Retrieves <em class="calibre21">Drive</em>'s volume label, where <em class="calibre21">Drive</em> is the drive letter followed by a colon and an optional backslash, or a UNC name such \\server1\share1. To change the label, follow this example: <a href="#Drive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Drive</a>, Label, C:, MyLabel</p>
<p class="calibre8"><strong class="calibre14">Serial, Drive </strong>: Retrieves <em class="calibre21">Drive</em>'s volume serial number expressed as decimal integer, where <em class="calibre21">Drive</em> is the drive letter followed by a colon and an optional backslash, or a UNC name such \\server1\share1. See <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a> for how to convert it to hexadecimal.</p>
<p class="calibre8"><strong class="calibre14">Type, Path</strong>: Retrieves <em class="calibre21">Path</em>'s drive type, which is one of the following words: Unknown, Removable, Fixed, Network, CDROM, RAMDisk.</p>
<p class="calibre8"><strong class="calibre14">Status, Path</strong>: Retrieves <em class="calibre21">Path</em>'s status, which is one of the following words: Unknown (might indicate unformatted/RAW), Ready, NotReady (typical for removable drives that don't contain media), Invalid (<em class="calibre21">Path</em> does not exist or is a network drive that is presently inaccessible, etc.)</p>
<p class="calibre8"><strong class="calibre14">StatusCD [, Drive]</strong> [v1.0.22+]: Retrieves the media status of a CD or DVD drive (if <em class="calibre21">Drive</em> is omitted, the default CD/DVD drive will be used). <em class="calibre21">OutputVar</em> is made blank if the status cannot be determined. Otherwise, it is set to one of the following words:</p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">not ready</td>
<td width="85%" class="calibre4">The drive is not ready to be accessed, perhaps due to being engaged in a write operation.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">open</td>
<td class="calibre4">The drive contains no disc, or the tray is ejected.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">playing</td>
<td class="calibre4">The drive is playing a disc.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">paused</td>
<td class="calibre4">The previously playing audio or video is now paused. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">seeking</td>
<td class="calibre4">The drive is seeking. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">stopped</td>
<td class="calibre4">The drive contains a disc but is not currently accessing it.</td>
</tr>
</tbody>
</table>
<p class="calibre8">This command will probably not work on a network drive or non-CD/DVD drive; if it fails in such cases or for any other reason, <em class="calibre21">OutputVar</em> is made blank and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1.</p>
<p class="calibre8">If the tray was recently closed, there may be a delay before the command completes. In addition, due to the nature of this command, there might be some keyboard or mouse lag (reduced responsiveness) during the operation if the script executing it has the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> and/or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hooks installed. This limitation will be resolved in a future release, if possible.</p>
<p class="calibre8">To eject or retract the tray, see the <a href="#Drive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Drive</a> command.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 of there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Some of the commands will accept a network share name as <em class="calibre21">Path</em>, such as \\MyServer\MyShare\</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Drive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Drive</a>, <a href="#DriveSpaceFree.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveSpaceFree</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">; This is a working example script.
FileSelectFolder, folder, , 3, Pick a drive to analyze:
if folder =
return
DriveGet, list, list
DriveGet, cap, capacity, %folder%
DrivespaceFree, free, %folder%
DriveGet, fs, fs, %folder%
DriveGet, label, label, %folder%
DriveGet, serial, serial, %folder%
DriveGet, type, type, %folder%
DriveGet, status, status, %folder%
MsgBox All Drives: %list%`nSelected Drive: %folder%`nDrive Type: %type%`nStatus: %status%`nCapacity: %cap% M`nFree Space: %free% M`nFilesystem: %fs%`nVolume Label: %label%`nSerial Number: %serial%
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="DriveSpaceFree.htm" href="#DriveSpaceFree.htm">#</a> <h2 class="calibre17">DriveSpaceFree</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the free disk space of a drive, in Megabytes.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">DriveSpaceFree, OutputVar, Path </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The variable in which to store the result, which is rounded down to the nearest whole number. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">path</td>
<td width="85%" class="calibre4">Path of drive to receive information from. Since NTFS supports mounted volumes and directory junctions, different amounts of free space might be available in different folders of the same "drive" in some cases.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">OutputVar is set to the amount of free disk space in Megabytes (rounded down to the nearest Megabyte).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Drive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Drive</a>, <a href="#DriveGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DriveGet</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">DriveSpaceFree, FreeSpace, c:\<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileAppend.htm" href="#FileAppend.htm">#</a> <h2 class="calibre17">FileAppend</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Appends text to a text file. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileAppend, Text, Filename</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Text</td>
<td width="85%" class="calibre4">
<p class="calibre8">The text to append to the file. This text can include newline characters by using `n.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Filename</td>
<td class="calibre4">
<p class="calibre8">The name of the file to be appended, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</p>
<p class="calibre8"><span class="tbd">To append in binary mode rather than text mode, prepend an asterisk to the filename. This causes each newline character (`n) to be written as as a single linefeed (LF) rather than the Windows standard of CR+LF. Example: *C:\My Unix File.txt</span></p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To overwrite an existing file, delete it with <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a> prior to using FileAppend. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileReadLine.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileReadLine</a>, <a href="#FileReadLine.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileReadLine</a>, <a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a>, <a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-read loop</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">FileAppend, Another line.`n, c:\My Documents\Test.txt</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileCopy.htm" href="#FileCopy.htm">#</a> <h2 class="calibre17">FileCopy</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Copies one or more files. <span class="x11">File modification date is not preserved, file name matching is case sensitive.</span></p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileCopy, SourcePattern, DestPattern [, Flag]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">SourcePattern</td>
<td class="calibre4">The name of a single file or folder, or a wildcard pattern such as /tmp/*.tmp. <em class="calibre21">SourcePattern </em>is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">DestPattern</td>
<td class="calibre4">The name or pattern of the destination, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. To perform a simple copy -- retaining the existing file name(s) -- specify only the folder name as shown in these functionally identical examples:<br class="calibre12" /> FileCopy, %A_Home%/*.txt, %A_Home%/My Folder<br class="calibre12" /> <span class="rm">FileCopy, %A_Home%/*.txt, %A_Home%/My Folder/*.*</span></td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Flag</td>
<td width="85%" class="calibre4">
<p class="calibre8">(optional) this flag determines whether to overwrite files if they already exist:</p>
<p class="calibre8">0 = (default) do not overwrite existing files<br class="calibre12" /> 1 = overwrite existing files</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the number of files that could not be copied due to an error, or 0 otherwise.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The operation will continue even if error(s) are encountered.</p>
<p class="calibre8">To copy an entire folder (including its subfolders), use <a href="#FileCopyDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopyDir</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>, <a href="#FileCopyDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopyDir</a>, <a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">FileCopy, C:\My Documents\List1.txt, D:\Main Backup\ ; Make a copy but keep the orig. file name.
FileCopy, C:\My File.txt, C:\My File New.txt ; Copy a file into the same folder by providing a new name.
FileCopy, C:\Folder1\*.txt, D:\New Folder\*.bkp ; Copy to new location and give new extension.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileCopyDir.htm" href="#FileCopyDir.htm">#</a> <h2 class="calibre17">FileCopyDir</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Copies a directory and all sub-directories and files (similar to xcopy).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileCopyDir, Source, Dest [, Flag]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Source</td>
<td class="calibre4"> Name of the source directory (with no trailing backslash), which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. For example: C:\My Folder </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Dest</td>
<td class="calibre4"> Name of the destination dir (with no trailing baskslash), which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. For example: C:\Copy of My Folder </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Flag</td>
<td width="85%" class="calibre4">
<p class="calibre8">(optional) this flag determines whether to overwrite files if they already exist:</p>
<p class="calibre8">0 = (default) do not overwrite existing files<br class="calibre12" /> 1 = overwrite existing files</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> If the destination directory structure doesn't exist it will be created if possible.</p>
<p class="calibre8">Since the operation will recursively copy a folder along with all its subfolders and files, the result of copying a folder to a destination somewhere inside itself is undefined. To work around this, first copy it to a destination outside itself, then use <a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a> to move that copy to the desired location.</p>
<p class="calibre8">Due to the nature of this command, there might be some keyboard or mouse lag (reduced responsiveness) during the operation if the script executing it has the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> and/or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hooks installed. This limitation will be resolved in a future release, if possible.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a>, <a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>, <a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-loops</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>, <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22"> FileCopyDir, C:\My Folder, C:\Copy of My Folder
; Example #2: A working script that prompts you to copy a folder.
FileSelectFolder, SourceFolder, , 3, Select the folder to copy
if SourceFolder =
return
; Otherwise, continue.
FileSelectFolder, TargetFolder, , 3, Select the folder IN WHICH to create the duplicate folder.
if TargetFolder =
return
; Otherwise, continue.
MsgBox, 4, , A copy of the folder "%SourceFolder%" will be put into "%TargetFolder%". Continue?
IfMsgBox, No
return
SplitPath, SourceFolder, SourceFolderName ; Extract only the folder name from its full path.
FileCopyDir, %SourceFolder%, %TargetFolder%\%SourceFolderName%
if ErrorLevel &lt;&gt; 0
MsgBox The folder could not be copied, perhaps because a folder of that name already exists in "%TargetFolder%".
return
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileCreateDir.htm" href="#FileCreateDir.htm">#</a> <h2 class="calibre17">FileCreateDir</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Creates a directory/folder. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileCreateDir, DirName </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">DirName</td>
<td width="85%" class="calibre4">Name of the directory to create, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p> This command will also create all parent directories given in <em class="calibre21">DirName</em> if they do not already exist. <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileRemoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRemoveDir</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileCreateDir, /a/b/Folder2</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileCreateShortcut.htm" href="#FileCreateShortcut.htm">#</a> <h2 class="calibre17">FileCreateShortcut</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Creates a shortcut (.lnk) file.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileCreateShortcut, Target, LinkFile [, WorkingDir, Args, Description, IconFile, ShortcutKey, IconNumber, RunState]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4"> Target </td>
<td width="85%" class="calibre4">Name of the file that the shortcut refers to, which should include an absolute path unless the file is integrated with the system (e.g. Notepad.exe). The file does not have to exist at the time the shortcut is created; in other words, shortcuts to invalid targets can be created.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">LinkFile</td>
<td class="calibre4">Name of the shortcut file to be created, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. Be sure to include the <strong class="calibre14">.lnk</strong> extension. If the file already exists, it will be overwritten.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WorkingDir</td>
<td class="calibre4">Directory that will become <em class="calibre21">Target's</em> current working directory when the shortcut is launched. If blank or omitted, the shortcut will have a blank "Start in" field and the system will provide a default working directory when the shortcut is launched.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Args</td>
<td class="calibre4">Parameters that will be passed to <em class="calibre21">Target</em> when it is launched. Separate parameters with spaces. If a parameter contains spaces, enclose it in double quotes.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Description</td>
<td class="calibre4">Comments that describe the shortcut (used by the OS to display a tooltip, etc.)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">IconFile</td>
<td class="calibre4">The full path and name of the icon to be displayed for <em class="calibre21">LinkFile</em>. It must either be an ico file or the very first icon of an EXE or DLL.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ShortcutKey</td>
<td class="calibre4">
<p class="calibre8">A single letter, number, or the name of a single key from the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list</a> (mouse buttons and other non-standard keys might not be supported). <strong class="calibre14">Do not</strong> include modifier symbols. Currently, all shortcut keys are created as CTRL+ALT shortcuts. For example, if the letter B is specified for this parameter, the shortcut key will be CTRL-ALT-B.</p>
<p class="calibre8">For Windows 9x: A reboot might be required to get the shortcut key into effect. Alternatively, you can open the properties dialog for the shortcut and recreate the shortcut key to get it into effect immediately.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">IconNumber</td>
<td class="calibre4">In v1.0.24+, to use an icon in <em class="calibre21">IconFile</em> other than the first, specify that number here. For example, 2 is the second icon.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">RunState</td>
<td class="calibre4">
<p class="calibre8">In v1.0.24+, to have <em class="calibre21">Target</em> launched minimized or maximized, specify one of the following digits:</p>
<p class="calibre8">1: Normal (this is the default)<br class="calibre12" /> 3: Maximized <br class="calibre12" /> 7: Minimized</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"><em class="calibre21">Target</em> might not need to include a path if the target file resides in one of the folders listed in the system's PATH environment variable. </p>
<p class="calibre8">The <em class="calibre21">ShortcutKey</em> of a newly created shortcut will have no effect unless the shortcut file resides on the desktop or somewhere in the Start Menu. If the <em class="calibre21">ShortcutKey</em> you choose is already in use, your new shortcut takes precedence.</p>
<p class="calibre8">You cannot define the window run-state to be "Minimized" or "Maximized"; the shortcuts always use "Normal."</p>
<p class="calibre8">An alternative way to create a shortcut to a URL is the following example, which creates a special URL shortcut. Change the first two parameters to suit your preferences:<br class="calibre12" />
<a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a>, http://www.google.com, C:\My Shortcut.url, InternetShortcut, URL
</p>
<p class="calibre8">The following may be optionally added to assign an icon to the above:<br class="calibre12" />
<a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a>, &lt;IconFile&gt;, C:\My Shortcut.url, InternetShortcut, IconFile<br class="calibre12" />
<a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a>, 0, C:\My Shortcut.url, InternetShortcut, IconIndex
</p>
<p class="calibre8">In the above, replace 0 with the index of the icon (0 is used for the first icon) and replace &lt;IconFile&gt; with a URL, EXE, DLL, or ICO file. Examples: C:\Icons.dll, C:\App.exe, http://www.somedomain.com/ShortcutIcon.ico</p>
<p class="calibre8">The operating system will treat a .URL file created by the above as a real shortcut even though it is a plain text file rather than a .LNK file.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileGetShortcut.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetShortcut</a>, <a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">; The letter "i" in the last parameter makes the shortcut key be Ctrl-Alt-I:</p>
<p class="calibre8">FileCreateShortcut, Notepad.exe, %HOMEDRIVE%%HOMEPATH%\Desktop\My Shortcut.lnk, C:\, "%A_ScriptFullPath%", My Description, C:\My Icon.ico, i</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileDelete.htm" href="#FileDelete.htm">#</a> <h2 class="calibre17">FileDelete</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Deletes one or more files. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileDelete, FilePattern </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">FilePattern</td>
<td width="85%" class="calibre4">The name of a single file or a wildcard pattern such as /tmp/*.tmp. <em class="calibre21">FilePattern </em>is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileRecycle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycle</a>, <a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>, <a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileDelete, /a/b/*.tmp <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileGetAttrib.htm" href="#FileGetAttrib.htm">#</a> <h2 class="calibre17">FileGetAttrib</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves a code string representing a file or folder's attributes.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileGetAttrib, OutputVar [, Filename]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved text.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Filename</td>
<td class="calibre4">The name of the target file, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. If omitted, the current file of the innermost enclosing <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-Loop</a> will be used instead.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p> String returned could contain a combination of these letters "RASHNDOCT"<br class="calibre12" />
<br class="calibre12" /> R = READONLY<br class="calibre12" /> A = ARCHIVE<br class="calibre12" /> S = SYSTEM<br class="calibre12" /> H = HIDDEN<br class="calibre12" /> N = NORMAL<br class="calibre12" /> D = DIRECTORY<br class="calibre12" /> O = OFFLINE<br class="calibre12" /> C = COMPRESSED<br class="calibre12" /> T = TEMPORARY<br class="calibre12" />
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a>, <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a>, <a href="#FileGetSize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetSize</a>, <a href="#FileGetVersion.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetVersion</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loop</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileGetAttrib, OutputVar, C:\New Folder </p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileGetShortcut.htm" href="#FileGetShortcut.htm">#</a> <h2 class="calibre17">FileGetShortcut</h2> [v1.0.24]
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves information about a shortcut (.lnk) file, such as its target file. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileGetShortcut, LinkFile [, OutTarget, OutDir, OutArgs, OutDescription, OutIcon, OutIconNum, OutRunState]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">LinkFile</td>
<td width="85%" class="calibre4">Name of the shortcut file to be analyzed, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. Be sure to include the <strong class="calibre14">.lnk</strong> extension.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutTarget</td>
<td class="calibre4">Name of the variable in which to store the shortcut's target (not including any arguments it might have). Example: C:\WINDOWS\system32\notepad.exe</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutDir</td>
<td class="calibre4">Name of the variable in which to store the shortcut's working directory. Example: C:\My Documents. To expand any environment variables that might be present (such as %windir%), follow this example: <a href="#Transform.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Transform</a>, OutDir, Deref, %OutDir%</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutArgs</td>
<td class="calibre4">Name of the variable in which to store the shortcut's parameters (blank if none).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutDescription</td>
<td class="calibre4">Name of the variable in which to store the shortcut's comments (blank if none).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutIcon</td>
<td class="calibre4">Name of the variable in which to store the filename of the shortcut's icon (blank if none).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutIconNum</td>
<td class="calibre4">Name of the variable in which to store the shortcut's icon number within the icon file (blank if none). This value is most often 1, which means the first icon. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutRunState</td>
<td class="calibre4">
<p class="calibre8">Name of the variable in which to store the shortcut's initial launch state, which is one of the following digits:</p>
<p class="calibre8">1: Normal<br class="calibre12" /> 3: Maximized <br class="calibre12" /> 7: Minimized<br class="calibre12" />
</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8">If there was a problem -- such as <em class="calibre21">LinkFile</em> not existing -- all the output variables are made blank and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1. Otherwise, ErrorLevel is set to 0.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Any of the output variables may be omitted if the corresponding information is not needed.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileCreateShortcut.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCreateShortcut</a>, <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">FileSelectFile, file,,, Pick a shortcut to analyze., Shortcuts (*.lnk)
if file =
return
FileGetShortcut, %file%, OutTarget, OutDir, OutArgs, OutDesc, OutIcon, OutIconNum, OutRunState
Transform, OutDir, Deref, %OutDir% ; Resolve any environment variables, such as %WinDir%.
MsgBox %OutTarget%`n%OutDir%`n%OutArgs%`n%OutDesc%`n%OutIcon%`n%OutIconNum%`n%OutRunState%</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileGetSize.htm" href="#FileGetSize.htm">#</a> <h2 class="calibre17">FileGetSize</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the size of a file in bytes, KB, or MB.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileGetSize, OutputVar [, Filename, Units] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the retrieved size (rounded down to the nearest whole number).</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the target file, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. If omitted, the current file of the innermost enclosing <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-Loop</a> will be used instead.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Units</td>
<td class="calibre4">
<p class="calibre8">If present, this parameter causes the result to be returned in units other than bytes:<br class="calibre12" /> K = kilobytes<br class="calibre12" /> M = megabytes</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Files over 4 gigabytes in size are supported (even if <em class="calibre21">Units</em> is bytes).</p>
<p class="calibre8">If the target file is a directory, the size will be reported as whatever the OS believes it to be (probably zero in all cases). </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileGetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetAttrib</a>, <a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a>, <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a>, <a href="#FileGetVersion.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetVersion</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loop</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileGetSize, size, C:\My Documents\test.doc ; Retrieve the size in bytes.<br class="calibre12" /> FileGetSize, size, C:\My Documents\test.doc, K ; Retrieve the size in Kbytes.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileGetTime.htm" href="#FileGetTime.htm">#</a> <h2 class="calibre17">FileGetTime</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the datetime stamp of a file or folder.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileGetTime, OutputVar [, Filename, WhichTime]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved date-time in format <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a>. The time is your own local time, not UTC/GMT.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the target file, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. If omitted, the current file of the innermost enclosing <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-Loop</a> will be used instead.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WhichTime</td>
<td class="calibre4">Which timestamp to retrieve:<br class="calibre12" /> M = Modification time (this is the default if the param is omitted)<br class="calibre12" /> C = Creation time<br class="calibre12" /> A = Last access time </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A file's last access time might not be as precise on Win9x as it is on NT based operating systems.</p>
<p class="calibre8">See <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> for a discussion of dates and times.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a>, <a href="#FormatTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FormatTime</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var is [not] type</a>, <a href="#FileGetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetAttrib</a>, <a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileGetSize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetSize</a>, <a href="#FileGetVersion.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetVersion</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loop</a>, <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a>, <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileGetTime, OutputVar, C:\My Documents\test.doc ; Retrieves the modification time by default. <br class="calibre12" /> FileGetTime, OutputVar, C:\My Documents\test.doc, C ; Retrieves the creation time.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileGetVersion.htm" href="#FileGetVersion.htm">#</a> <h2 class="calibre17">FileGetVersion</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the version of a file.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileGetVersion, OutputVar [, Filename] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the retrieved size. The value is rounded down to the nearest whole number.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the target file, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. If omitted, the current file of the innermost enclosing <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-Loop</a> will be used instead.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Most non-executable files (and even some EXEs) won't have a version, and thus the OutputVar will be blank in these cases.<br class="calibre12" />
</p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileGetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetAttrib</a>, <a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a>, <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a>, <a href="#FileGetSize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetSize</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loop</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">FileGetVersion, version, C:\My Application.exe<br class="calibre12" /> FileGetVersion, version, %ProgramFiles%\AutoHotkey\AutoHotkey.exe</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileInstall.htm" href="#FileInstall.htm">#</a> <h2 class="calibre17">FileInstall</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Includes the specified file inside the compiled script (Ahk2Exe).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileInstall, Source, Dest, Flag</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Source</td>
<td class="calibre4">The full path and name of the file to add to the compiled EXE. It <strong class="calibre14">must not</strong> contain double quotes, variable references (e.g. %ProgramFiles%), or wildcards.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Dest</td>
<td class="calibre4">When <em class="calibre21">Source</em> is extracted from the EXE, this is the name of the file to be created. It is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. Unlike <em class="calibre21">Source</em>, variable references may be used.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Flag</td>
<td width="85%" class="calibre4">
<p class="calibre8">(optional) this flag determines whether to overwrite files if they already exist:</p>
<p class="calibre8">0 = (default) do not overwrite existing files<br class="calibre12" /> 1 = overwrite existing files</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> This command is a directive for the <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Ahk2Exe compiler</a> that allows you to add extra files to the resulting compiled script. Later, when the compiled script is run, the files are extracted back out onto the disk.</p>
<p class="calibre8">The file <em class="calibre21">Source</em> is added <strong class="calibre14">during script compilation </strong>.  When the compiled script is executed and the same "FileInstall" command has been reached, the file is then extracted to <em class="calibre21">Dest</em>.</p>
<p class="calibre8">Files added to a script are compressed and also encrypted.</p>
<p class="calibre8">If this command is used in an normal (uncompiled) script, a simple file copy will be performed instead -- this will help the testing of scripts that will eventually be compiled. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileInstall, C:\My Documents\My File.txt, %ProgramFiles%\My Application\Readme.txt, 1 <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileMove.htm" href="#FileMove.htm">#</a> <h2 class="calibre17">FileMove</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Moves or renames one or more files.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileMove, SourcePattern, DestPattern [, Flag]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">SourcePattern</td>
<td class="calibre4">The name of a single file or a wildcard pattern such as C:\Temp\*.tmp. <em class="calibre21">SourcePattern </em>is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">DestPattern</td>
<td class="calibre4">The name or pattern of the destination, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. To perform a simple move -- retaining the existing file name(s) -- specify only the folder name as shown in these functionally identical examples:<br class="calibre12" /> FileMove, C:\*.txt, C:\My Folder<br class="calibre12" /> FileMove, C:\*.txt, C:\My Folder\*.*</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Flag</td>
<td width="85%" class="calibre4">
<p class="calibre8">(optional) this flag determines whether to overwrite files if they already exist:</p>
<p class="calibre8">0 = (default) do not overwrite existing files<br class="calibre12" /> 1 = overwrite existing files</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the number of files that could not be moved due to an error, or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> The operation will continue even if error(s) are encountered.</p>
<p class="calibre8">If the source and destination paths are on different volumes a copy and delete operation is performed rather than a move.</p>
<p class="calibre8">To move or rename a folder, use <a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>, <a href="#FileCopyDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopyDir</a>, <a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a>
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">FileMove, C:\My Documents\List1.txt, D:\Main Backup\ ; Move the file without renaming it.
FileMove, C:\File Before.txt, C:\File After.txt ; Rename a single file.
FileMove, C:\Folder1\*.txt, D:\New Folder\*.bkp ; Move and rename files to a new extension.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileMoveDir.htm" href="#FileMoveDir.htm">#</a> <h2 class="calibre17">FileMoveDir</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Moves a directory and all sub-directories and files. It can also rename a directory. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileMoveDir, Source, Dest [, Flag]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Source</td>
<td class="calibre4"> Name of the source directory (with no trailing backslash), which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. For example: C:\My Folder </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Dest</td>
<td class="calibre4"> Name of the destination directory (with no trailing baskslash), which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. For example: D:\My Folder</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Flag</td>
<td width="85%" class="calibre4">
<p class="calibre8">(options) Specify one of the following single characters:</p>
<p class="calibre8">0 = (default) do not overwrite existing files<br class="calibre12" /> 1 = overwrite existing files<br class="calibre12" /> R = Rename the directory rather than moving it. Although "renaming" normally has the same effect as "moving", it is helpful in cases where you want "all or none" behavior; that is, when you don't want the operation to be only partially successful if <em class="calibre21">Source</em> or one of its files is locked (in use). Although this method cannot move <em class="calibre21">Source</em> onto a different volume, it can move it to any other directory on its own volume. The operation will fail if <em class="calibre21">Dest</em> already exists as a file or directory. [Requires v1.0.22+]</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> If the source and destination are on different volumes or UNC paths, a copy/delete operation will be performed rather than a move. </p>
<p class="calibre8">If the destination already exists and the overwrite flag is specified, the source directory will be moved <strong class="calibre14">inside </strong> the destination.</p>
<p class="calibre8">Due to the nature of this command, there might be some keyboard or mouse lag (reduced responsiveness) during the operation if the script executing it has the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> and/or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hooks installed. This limitation will be resolved in a future release, if possible.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRead</a>, <a href="#FileCopyDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopyDir</a>, <a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>, <a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loops</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>, <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileMoveDir, C:\My Folder, D:\My Folder ; Move to a new drive. <br class="calibre12" /> FileMoveDir, C:\My Folder, C:\My Folder (renamed), 1</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileReadLine.htm" href="#FileReadLine.htm">#</a> <h2 class="calibre17">FileReadLine</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Reads the specified line from a file and stores the text in a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileReadLine, OutputVar, Filename, LineNum</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> in which to store the retrieved text. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the file to access, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">LineNum</td>
<td class="calibre4">Which line to read (1 is the first, 2 the second, and so on). </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Although any leading and trailing tabs and spaces present in the line will be written to <em class="calibre21">OutputVar</em>, the newline character (`n) at the end of the line will not. Tabs and spaces can be trimmed from both ends of any variable by assigning it to itself while <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a> is off (the default). For example: MyLine = %MyLine%</p>
<p class="calibre8 tbd">Lines up to 65,534 characters long can be read. If the length of a line exceeds this, the remaining characters cannot be retrieved by this command (use a <a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-read loop</a> instead).</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a>, <a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-read loop</a>, <a href="#IniRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniRead</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">i = 0
Loop
{
i += 1
FileReadLine, line, %A_Home%/Documents/ContactList.txt, %i%
if ErrorLevel &lt;&gt; 0
break
MsgBox, 4, , Line #%i% is "%line%". Continue?
IfMsgBox, No
return
}
MsgBox, The end of the file has been reached or there was a problem.
return</pre>
</div>
</div>
<div class="calibreMain x11">
<div class="calibreEbookContent">
<a id="FileRead.htm" href="#FileRead.htm">#</a> <h2 class="calibre17">FileRead</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Reads the specified file into a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileRead, OutputVar, Filename</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> in which to store the retrieved text. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the file to access, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">i = 0
FileRead, text, %A_Home%/Documents/ContactList.txt
MsgBox, text is "%text%"
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileRecycle.htm" href="#FileRecycle.htm">#</a> <h2 class="calibre17">FileRecycle</h2> [v1.0.09+]
<hr size="2" class="calibre24" />
<p class="calibre8">Sends a file or directory to the recycle bin, if possible.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileRecycle, FilePattern </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">FilePattern</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of a single file or a wildcard pattern such as C:\Temp\*.tmp. <em class="calibre21">FilePattern </em>is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</p>
<p class="calibre8">To recycle an entire directory, provide its name without a trailing backslash.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> None </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileRecycleEmpty.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycleEmpty</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a>, <a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>, <a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileRecycle, C:\temp files\*.tmp <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileRecycleEmpty.htm" href="#FileRecycleEmpty.htm">#</a> <h2 class="calibre17">FileRecycleEmpty</h2> [v1.0.09+]
<hr size="2" class="calibre24" />
<p class="calibre8">Empties the recycle bin. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileRecycleEmpty [, DriveLetter]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">DriveLetter</td>
<td width="85%" class="calibre4">If omitted, the recycle bin for all drives is emptied. Otherwise, specify a drive letter such as C:\</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> This commands requires MS Internet Explorer 4 or greater to be installed.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileRecycle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileRecycle</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a>, <a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a>, <a href="#FileMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMove</a>
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileRecycleEmpty, C:\ <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FileRemoveDir.htm" href="#FileRemoveDir.htm">#</a> <h2 class="calibre17">FileRemoveDir</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Deletes a directory/folder. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileRemoveDir, DirName [, Recurse?]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">DirName</td>
<td width="85%" class="calibre4">Name of the directory to delete, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Recurse?</td>
<td class="calibre4">
<p class="calibre8">0 (default): Do <strong class="calibre14">not</strong> remove files and sub-directories contained in <em class="calibre21">DirName</em>. In this case, if <em class="calibre21">DirName</em> is not empty, no action will be taken and ErrorLevel will be set to 1.</p>
<p class="calibre8">1: Remove all files and subdirectories (like the DOS DelTree command).</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileCreateDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCreateDir</a>, <a href="#FileDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileDelete</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> FileRemoveDir, C:\Download Temp<br class="calibre12" /> FileRemoveDir, C:\Download Temp, 1</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileSelectFile.htm" href="#FileSelectFile.htm">#</a> <h2 class="calibre17">FileSelectFile</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays a standard dialog that allows the user to select file(s).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileSelectFile, OutputVar [, Options, RootDir, Prompt, <span class="tbd">Filter</span>]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the name of the folder selected by the user. This will be made blank if the user cancels the dialog (i.e. does not wish to select a file). </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">
<p class="calibre8">If omitted, it will default to zero, which is the same as having NONE of the below options. <span class="tbd">
Otherwise, add up one or more of the desired values (for example, to use options 1 and 16, specify a value of 17):<br class="calibre12" /> 1 = File Must Exist<br class="calibre12" /> 2 = Path Must Exist<br class="calibre12" /> 4 = Allow MultiSelect (see Examples for how to extract the individual files) <br class="calibre12" /> 8 = Prompt to Create New File<br class="calibre12" /> 16 = Prompt to OverWrite File</span></p>
<p class="calibre8 tbd">If the "Prompt to Overwrite" option is present without the "Prompt to Create" option, the dialog will contain a Save button rather than an Open button (this behavior is due to a quirk in Windows).</p>
<p class="calibre8">In v1.0.14+, specify the letter S as the first character to cause the dialog to always contain a Save button (e.g. S16 or just S).</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">RootDir</td>
<td class="calibre4">
<p class="calibre8">Root (starting) directory, which is assumed to be a subfolder in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. If omitted or blank, the starting directory will be a default that might depend on the OS version. <span class="rm">In WinNT/2k/XP and beyond, it will likely be the directory most recently selected by the user during a prior use of FileSelectFile.</span></p>
<p class="calibre8"><span class="tbd">In v1.0.09+, to specify a default filename for the dialog's edit field, add that filename after the directory as in this example: C:\My Documents\My Pictures\Default Image Name.gif. Only the naked filename (with no path) will be used as the default.</span> </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Prompt</td>
<td class="calibre4">Text displayed in the window to instruct the user what to do. If omitted or blank, it will default to "Select File - %A_SCRIPTNAME%" (i.e. the name of the current script).</td>
</tr>
<tr class="calibre3 tbd">
<td class="calibre4">Filter</td>
<td class="calibre4">
<p class="calibre8">Indicates which types of files are shown by the dialog.</p>
<p class="calibre8">Example: Documents (*.txt)<br class="calibre12" /> Example: Audio (*.wav; *.mp2; *.mp3)</p>
<p class="calibre8">If omitted, the filter defaults to All Files (*.*). An option for Text Documents (*.txt) will also be available in the dialog's "files of type" menu.</p>
<p class="calibre8">Otherwise, the filter uses the indicated string but also provides an option for All Files (*.*) in the dialog's "files of type" menu. To include more than one file extension in the filter, separate them with semicolons as illustrated in the example above.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"><em class="calibre21">OutputVar</em> will be set to the full path and name of file chosen by the user. If the user didn't select a file (e.g. pressed CANCEL), <em class="calibre21">OutputVar</em> will be made blank.</p>
<p class="calibre8">If <em class="calibre21">Options</em> permit it and the user selected more than one file, <em class="calibre21">OutputVar</em> will be set to a list of items, each of which is followed by a newline (`n) character (including the last item). The first item in the list is the directory that contains all of the selected files. The other items are the selected filenames, not including their path. For example: <br class="calibre12" /> C:\My Documents\Test [this is the directory in which all the below files reside]<br class="calibre12" /> test1.txt [these names are the naked filenames: no path info]<br class="calibre12" /> test2.txt<br class="calibre12" /> ... etc<br class="calibre12" /> (See Examples below for more information)</p>
<p class="calibre8">See the <em class="calibre21">RootDir</em> parameter above for how to put a default filename in the dialog's edit field.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a>, <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt)
if SelectedFile =
MsgBox, The user didn't select anything.
else
MsgBox, The user selected the following:`n%SelectedFile%
; MULTI-SELECT EXAMPLE:
FileSelectFile, files, 7 ; 7 = Multiselect existing files.
if files =
{
MsgBox, The user pressed cancel.
return
}
Loop, parse, files, `n
{
if A_LoopField = ; A blank field marks the end of the list.
break
if a_index = 1
MsgBox, The selected files are all contained in %A_LoopField%.
else
{
MsgBox, 4, , The next file is %A_LoopField%. Continue?
IfMsgBox, No, break
}
}
return
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileSelectFolder.htm" href="#FileSelectFolder.htm">#</a> <h2 class="calibre17">FileSelectFolder</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays a standard dialog that allows the user to select a folder.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileSelectFolder, OutputVar [, RootPath, Options, Prompt]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the user's selected folder. This will be made blank if the user cancels the dialog (i.e. does not wish to select a folder). </td>
</tr>
<tr class="calibre3">
<td class="calibre4">RootPath</td>
<td class="calibre4">
<p class="calibre8">Root (starting) directory, which must include an absolute path, e.g. %A_Home%/Documents/Pictures</p>
<p class="calibre8">If omitted or blank, it will default to <span class="x11">"My Computer"</span>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4 tbd">
<p class="calibre8">One of the following numbers:<br class="calibre12" /> 0: None of the below options is enabled.<br class="calibre12" /> 1 (default): A button is provided that allows the user to create new folders. This option has no effect unless the operating system is Windows Me/2000/XP or later.</p>
<p class="calibre8">In v1.0.09+, add 2 to the above number to provide an edit field that allows the user to type the name of a folder. For example, a value of 3 for this parameter provides both an edit field and a "make new folder" button.</p>
<p class="calibre8">If the user types an invalid folder name in the edit field, <em class="calibre21">OutputVar</em> will be set to the folder selected in the navigation tree rather than what the user entered, at least on Windows XP. <br class="calibre12" />
</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Prompt</td>
<td class="calibre4">Text displayed in the window to instruct the user what to do. If omitted or blank, it will default to "Select Folder - %A_SCRIPTNAME%" (i.e. the name of the current script).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">None.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a>, <a href="#FileCopyDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopyDir</a>, <a href="#FileMoveDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileMoveDir</a>, <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">FileSelectFolder, OutputVar, , 3
if OutputVar =
MsgBox, You didn't select a folder.
else
MsgBox, You selected folder "%OutputVar%".</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileSetAttrib.htm" href="#FileSetAttrib.htm">#</a> <h2 class="calibre17">FileSetAttrib</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the attributes of one or more files or folders. Wildcards are supported.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileSetAttrib, Attributes [, FilePattern, OperateOnFolders?, Recurse?]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Attributes</td>
<td width="85%" class="calibre4">The attributes to change (see Remarks).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">FilePattern</td>
<td class="calibre4">The name of a single file or folder, or a wildcard pattern such as C:\Temp\*.tmp. <em class="calibre21">FilePattern </em>is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. <p class="calibre8">If omitted, the current file of the innermost enclosing <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-Loop</a> will be used instead.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OperateOnFolders?</td>
<td class="calibre4">
<p class="calibre8">0 (default) Folders are not operated upon (only files). <br class="calibre12" /> 1 All files and folders that match the wildcard pattern are operated upon.<br class="calibre12" /> 2 Only folders are operated upon (no files). </p>
<p class="calibre8">Note: If FilePattern is a single folder rather than a wildcard pattern, it will always be operated upon regardless of this setting.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Recurse?</td>
<td class="calibre4">
<p class="calibre8">0 (default) Subfolders are not recursed into.<br class="calibre12" /> 1 Subfolders are recursed into so that files and folders contained therein are operated upon if they match &lt;FilePattern&gt;. All subfolders will be recursed into, not just those whose names match &lt;FilePattern&gt;. </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the number of files that failed to be changed (if any) or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The Attributes parameter consists of a collection of operators and attribute letters.</p>
<p class="calibre8"><em class="calibre21">Operators</em>:</p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="23" class="calibre4">+</td>
<td class="calibre4">Turn on the attribute </td>
</tr>
<tr class="calibre3">
<td class="calibre4">-</td>
<td class="calibre4">Turn off the attribute </td>
</tr>
<tr class="calibre3">
<td class="calibre4">^</td>
<td class="calibre4">Toggle the attribute (set it to the opposite value of what it is now)</td>
</tr>
</tbody>
</table>
<p class="calibre8"><br class="calibre12" />
<em class="calibre21">Attribute letters</em>:<br class="calibre12" /> <span class="tbd">R = READONLY<br class="calibre12" /> A = ARCHIVE<br class="calibre12" /> S = SYSTEM<br class="calibre12" /> H = HIDDEN<br class="calibre12" /> N = NORMAL (this is only valid when used without any other attributes) <br class="calibre12" /> O = OFFLINE<br class="calibre12" /> T = TEMPORARY</span> <br class="calibre12" /> X = EXECUTABLE
</p>
<p class="calibre8 rm">Note: Currently, the compression state of files cannot be changed with this command. </p>
<p class="calibre8 x11">Currently, only executable rights (for the current user) can be toggled with this (it switches between 755 and 644 internally). Linux file system permission rights are much more capable than that. For more complex use cases, use chown or chmod with something like: RunWait, chmod 666 filename</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the number of files that failed to be changed (if any) or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileGetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetAttrib</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a>, <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a>, <a href="#FileGetSize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetSize</a>, <a href="#FileGetVersion.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetVersion</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loop</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8"> FileSetAttrib, +RH, C:\MyFiles\*.*, 1 ; +RH is identical to +R+H<br class="calibre12" /> FileSetAttrib, ^H, C:\MyFiles ; Toggle the folder's "hidden" attribute.<br class="calibre12" /> FileSetAttrib, -R+A, C:\New Text File.txt<br class="calibre12" /> FileSetAttrib, +A, C:\*.ini, , 1 ; Recurse through all .ini files on the C drive.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FileSetTime.htm" href="#FileSetTime.htm">#</a> <h2 class="calibre17">FileSetTime</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the datetime stamp of one or more files or folders. Wildcards are supported.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FileSetTime [, YYYYMMDDHH24MISS, FilePattern, WhichTime, OperateOnFolders?, Recurse?]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">YYYYMMDDHH24MISS</td>
<td width="85%" class="calibre4">If omitted, it defaults to the current time. Otherwise, specify the time to use for the operation (see Remarks for the format). Years prior to 1601 are not supported.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">FilePattern</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of a single file or folder, or a wildcard pattern such as /tmp/*.tmp. <em class="calibre21">FilePattern</em> is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</p>
<p class="calibre8">If omitted, the current file of the innermost enclosing <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-Loop</a> will be used instead.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WhichTime</td>
<td class="calibre4">Which timestamp to set:<br class="calibre12" /> M = Modification time (this is the default if the param is omitted)<br class="calibre12" /> <span class="tbd">C = Creation time<br class="calibre12" /> A = Last access time </span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">OperateOnFolders?</td>
<td class="calibre4">
<p class="calibre8">0 (default) Folders are not operated upon (only files). <br class="calibre12" /> 1 All files and folders that match the wildcard pattern are operated upon.<br class="calibre12" /> 2 Only folders are operated upon (no files). </p>
<p class="calibre8">Note: If FilePattern is a single folder rather than a wildcard pattern, it will always be operated upon regardless of this setting.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Recurse?</td>
<td class="calibre4">0 (default) Subfolders are not recursed into.<br class="calibre12" /> 1 Subfolders are recursed into so that files and folders contained therein are operated upon if they match <em class="calibre21">FilePattern</em>. All subfolders will be recursed into, not just those whose names match <em class="calibre21">FilePattern</em>. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the number of files that <u class="calibre20">failed</u> to be changed (if any) or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 rm">Under Windows 95/98/ME, changing the timestamp of folders is not supported. Attempts to do so are ignored.</p>
<p class="calibre8">A file's last access time might not be as precise on FAT16 &amp; FAT32 volumes as it is on NTFS volumes.</p>
<p class="calibre8"><a id="FileSetTime.htm__YYYYMMDD" href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> The elements of the YYYYMMDDHH24MISS format are:</p>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="46" class="calibre4">YYYY</td>
<td class="calibre4">The 4-digit year</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MM</td>
<td class="calibre4">The 2-digit month (01-12) </td>
</tr>
<tr class="calibre3">
<td class="calibre4">DD</td>
<td class="calibre4">The 2-digit day of the month (01-31)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">HH24</td>
<td class="calibre4">The 2-digit hour in 24-hour format (00-23) e.g. 09 is 9am, 21 is 9pm</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MI</td>
<td class="calibre4">The 2-digit minutes (00-59)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SS</td>
<td class="calibre4">The 2-digit seconds (00-59)</td>
</tr>
</tbody>
</table>
<p class="calibre8">If only a partial string is given for YYYYMMDDHH24MISS (e.g. 200403), any remaining element that has been omitted will be supplied with the following default values:</p>
<p class="calibre8">MM: Month 01<br class="calibre12" /> DD: Day 01<br class="calibre12" /> HH24: Hour 00<br class="calibre12" /> MI: Minute 00<br class="calibre12" /> SS: Second 00</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_Now</strong> contains the current local time in the above format.</p>
<p class="calibre8"><strong class="calibre14">Note:</strong> Date-time values can be compared, added to, or subtracted from via <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a> and <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a>. Also, it is best to not use greater-than or less-than to compare times unless they are both the same string length. This is because they would be compared as numbers, e.g. 20040201 is always numerically less (but chronologically greater) than 200401010533. So instead use <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a> to find out whether the amount of time between them is positive or negative.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a>, <a href="#FileGetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetAttrib</a>, <a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileGetSize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetSize</a>, <a href="#FileGetVersion.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetVersion</a>, <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loop</a>, <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a>, <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">; Set the modification time to the current time for all matching files:<br class="calibre12" /> FileSetTime, , /tmp/*.txt<br class="calibre12" />
<br class="calibre12" /> ; Set the modification date (time will be midnight):<br class="calibre12" /> FileSetTime, 20040122, %A_Home%/Documents/test.doc<br class="calibre12" />
<br class="calibre12" /> ; Set the creation date. The time will be set to 4:55pm:<br class="calibre12" /> FileSetTime, 200401221655, %A_Home%/Documents/test.doc, C<br class="calibre12" />
<br class="calibre12" /> ; Change the mod-date of all files that match a pattern.<br class="calibre12" /> ; Any matching folders will also be changed due to the last param:<br class="calibre12" /> FileSetTime, 20040122165500, /tmp/*.*, M, 1
</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfExist.htm" href="#IfExist.htm">#</a> <h2 class="calibre17">IfExist / IfNotExist</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks for the existence of a file or directory.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IfExist, FilePattern<br class="calibre12" /> IfNotExist, FilePattern</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">FilePattern</td>
<td width="85%" class="calibre4">The path, filename, or file pattern to check. <em class="calibre21">FilePattern</em> is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a>, <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-loops</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">IfExist, /mnt/drive
MsgBox, The drive exists.
IfExist, %A_Home%/Documents/*.txt
MsgBox, At least one .txt file exists.
IfNotExist, /tmp/FlagFile.txt
MsgBox, The target file does not exist.
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IniDelete.htm" href="#IniDelete.htm">#</a> <h2 class="calibre17">IniDelete</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Deletes a value from a standard format .ini file. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IniDelete, Filename, Section [, Key]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the .ini file, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Section</td>
<td class="calibre4">The section name in the .ini file, which is the heading phrase that appears in square brackets (do not include the brackets in this parameter). </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Key</td>
<td class="calibre4">The key name in the in the .ini file. <strong class="calibre14">If omitted (in v1.0.10+), the entire <em class="calibre21">Section</em> will be deleted.</strong> </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A standard ini file looks like:</p>
<p class="calibre8">[SectionName]<br class="calibre12" /> Key=Value</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IniRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniRead</a>, <a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a>, <a href="#RegDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegDelete</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> IniDelete, /tmp/myfile.ini, section2, key<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IniRead.htm" href="#IniRead.htm">#</a> <h2 class="calibre17">IniRead</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Reads a value from a standard format .ini file. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IniRead, OutputVar, Filename, Section, Key [, Default]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the retrieved value. If the value cannot be retrieved, the variable is set to the value indicated by the <em class="calibre21">Default</em> parameter (described below). </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the .ini file, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Section</td>
<td class="calibre4">The section name in the .ini file, which is the heading phrase that appears in square brackets (do not include the brackets in this parameter).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Key</td>
<td class="calibre4">The key name in the in the .ini file.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Default</td>
<td class="calibre4">
<p class="calibre8">The value to store in <em class="calibre21">OutputVar</em> if the requested key is not found. If omitted, it defaults to the word ERROR.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is <strong class="calibre14">not</strong> set by this command. If there was a problem, <em class="calibre21">OutputVar</em> will be set to the <em class="calibre21">Default</em> value as described above. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> A standard ini file looks like:</p>
<p class="calibre8">[SectionName]<br class="calibre12" /> Key=Value</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IniDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniDelete</a>, <a href="#IniWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniWrite</a>, <a href="#RegRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegRead</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> IniRead, OutputVar, /tmp/myfile.ini, section2, key<br class="calibre12" /> MsgBox, The value is %OutputVar%.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IniWrite.htm" href="#IniWrite.htm">#</a> <h2 class="calibre17">IniWrite</h2>
<hr size="2" class="calibre24" />
<p class="calibre8"> Writes a value to a standard format .ini file. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IniWrite, Value, Filename, Section, Key </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Value</td>
<td class="calibre4">The string or number that will be written to the right of <em class="calibre21">Key</em>'s equals sign.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Filename</td>
<td width="85%" class="calibre4">The name of the .ini file, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Section</td>
<td class="calibre4">The section name in the .ini file, which is the heading phrase that appears in square brackets (do not include the brackets in this parameter).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Key</td>
<td class="calibre4">The key name in the in the .ini file.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A standard ini file looks like:</p>
<p class="calibre8">[SectionName]<br class="calibre12" /> Key=Value</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IniDelete.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniDelete</a>, <a href="#IniRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IniRead</a>, <a href="#RegWrite.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegWrite</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> IniWrite, this is a new value, /tmp/myfile.ini, section2, key<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="LoopFile.htm" href="#LoopFile.htm">#</a> <h2 class="calibre17">Loop (files &amp; folders) </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the specified files or folders, one at a time.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4"> Loop, FilePattern [, IncludeFolders?, Recurse?] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">FilePattern</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of a single file or folder, or a wildcard pattern such as /tmp/*.tmp. <em class="calibre21">FilePattern</em> is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</p>
<p class="calibre8">Both asterisks and question marks are supported as wildcards. </p>
<p class="calibre8">If this parameter is a single file or folder (i.e. no wildcards) and <em class="calibre21">Recurse</em> is set to 1, more than one match will be found if the specified file name appears in more than one of the folders being searched.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">IncludeFolders?</td>
<td class="calibre4">
<p class="calibre8">0 (default) Folders are not retrieved (only files).<br class="calibre12" /> 1 All files and folders that match the wildcard pattern are retrieved.<br class="calibre12" /> 2 Only folders are retrieved (no files).</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Recurse?</td>
<td class="calibre4">0 (default) Subfolders are not recursed into.<br class="calibre12" /> 1 Subfolders are recursed into so that files and folders contained therein are retrieved if they match <em class="calibre21">FilePattern</em>. All subfolders will be recursed into, not just those whose names match <em class="calibre21">FilePattern</em>. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A file-loop is useful when you want to operate on a collection of files and/or folders, one at a time.</p>
<p class="calibre8">All matching files are retrieved, <span class="tbd">including hidden files</span> <span class="x11">(unsure)</span>. By contrast, OS features such as the <span class="rm">DIR</span> <span class="x11">ls</span> command omit hidden files by default.</p>
<p class="calibre8">Files on an NTFS file system are probably always retrieved in alphabetical order. Files on other file systems are retrieved in no particular order. To ensure a particular ordering, use the <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a> command as shown in the Examples below. </p>
<p class="calibre8">The following variables exist within any file-loop. If an inner file-loop is enclosed by an outer file-loop, the innermost loop's file will take precedence:</p>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">A_LoopFileName</td>
<td class="calibre4">The name of the file or folder currently retrieved (without the path). </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileFullPath</td>
<td class="calibre4">The full path and name of the file/folder currently retrieved. However, if <em class="calibre21">FilePattern </em>contains a relative path rather than an absolute path, the path here will also be relative. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileShortName</td>
<td class="calibre4"><span class="rm">The 8.3 short name, or alternate name of the file. If the file doesn't have one (due to the long name being shorter than 8.3 or perhaps because short-name generation is disabled on the NTFS file system),</span> <em class="calibre21">A_LoopFileName</em> will be retrieved instead. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileDir</td>
<td class="calibre4">The full path of the directory in which <em class="calibre21">A_LoopFileName</em> resides. However, if <em class="calibre21">FilePattern </em>contains a relative path rather than an absolute path, the path here will also be relative. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileTimeModified</td>
<td class="calibre4">The time the file was last modified. Format <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a>.</td>
</tr>
<tr class="calibre3 tbd">
<td class="calibre4">A_LoopFileTimeCreated</td>
<td class="calibre4">The time the file was created. Format <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileTimeAccessed</td>
<td class="calibre4">The time the file was last accessed. Format <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a>.</td>
</tr>
<tr class="calibre3 tbd">
<td class="calibre4">A_LoopFileAttrib</td>
<td class="calibre4">The <a href="#FileGetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">attributes</a> of the file currently retrieved.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileSize</td>
<td class="calibre4">The size in bytes of the file currently retrieved. Files larger than 4 gigabytes are supported. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileSizeKB</td>
<td class="calibre4">The size in Kbytes of the file currently retrieved.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A_LoopFileSizeMB</td>
<td class="calibre4">The size in Mbytes of the file currently retrieved.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8">See <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a> for information about <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, and the A_Index variable (which exists in every type of loop).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks, </a><a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Example #1:
Loop, %ProgramFiles%\*.txt, , 1 ; Recurse into subfolders.
{
MsgBox, 4, , Filename = %A_LoopFileFullPath%`n`nContinue?
IfMsgBox, No
break
}
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #2: Calculate the size of a folder, including the files in all its subfolders:
SetBatchLines, -1 ; Make the operation run at maximum speed.
FolderSizeKB = 0
FileSelectFolder, WhichFolder
Loop, %WhichFolder%/*.*, , 1
FolderSizeKB += %A_LoopFileSizeKB%
MsgBox Size of %WhichFolder% is %FolderSizeKB% KB.
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #3: Retrieve file names sorted by name (see next example to sort by date):
FileList = ; Initialize to be blank.
Loop, C:\*.*
FileList = %FileList%%A_LoopFileName%`n
Sort, FileList, R ; The R option sorts in reverse order. See <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a> for other options.
Loop, parse, FileList, `n
{
if A_LoopField = ; Ignore the blank item at the end of the list.
continue
MsgBox, 4,, File number %A_Index% is %A_LoopField%. Continue?
IfMsgBox, No
break
}
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #4: Retrieve file names sorted by modification date:
FileList =
Loop, %UserProfile%\Recent\*.*, 1 ; UserProfile exists as an environment variable on some OSes.
FileList = %FileList%%A_LoopFileTimeModified%`t%A_LoopFileName%`n
Sort, FileList ; Sort by date.
Loop, parse, FileList, `n
{
if A_LoopField = ; Omit the last linefeed (blank item) at the end of the list.
continue
StringSplit, FileItem, A_LoopField, %A_Tab% ; Split into two parts at the tab char.
MsgBox, 4,, The next file (modified at %FileItem1%) is:`n%FileItem2%`n`nContinue?
IfMsgBox, No
break
}
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #5: Copy only the source files that are newer than their counterparts
; in the destination:
CopyIfNewer:
; Caller has set the variables CopySourcePattern and CopyDest for us.
Loop, %CopySourcePattern%
{
copy_it = n
IfNotExist, %CopyDest%\%A_LoopFileName% ; Always copy if target file doesn't yet exist.
copy_it = y
else
{
FileGetTime, time, %CopyDest%\%A_LoopFileName%
EnvSub, time, %A_LoopFileTimeModified%, seconds ; Subtract the source file's time from the destination's.
if time &lt; 0 ; Source file is newer than destination file.
copy_it = y
}
if copy_it = y
{
FileCopy, %A_LoopFileFullPath%, %CopyDest%\%A_LoopFileName%, 1 ; Copy with overwrite=yes
if ErrorLevel &lt;&gt; 0
MsgBox, Could not copy "%A_LoopFileFullPath%" to "%CopyDest%\%A_LoopFileName%".
}
}
Return</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="LoopReadFile.htm" href="#LoopReadFile.htm">#</a> <h2 class="calibre17">Loop (read file contents) </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the lines in a text file, one by one (performs better than <a href="#FileReadLine.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileReadLine</a>). </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4"> Loop, Read, InputFile [, OutputFile, FutureUse]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Read</td>
<td width="85%" class="calibre4">This parameter must be the word READ.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">InputFile</td>
<td class="calibre4">
<p class="calibre8">The name of the file whose contents will be read by the loop, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutputFile</td>
<td class="calibre4">
<p class="calibre8">(Optional) The name of the file to be kept open for the duration of the loop, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</p>
<p class="calibre8">Within the loop's body, use the <a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a> command with only one parameter (the text to be written) to append to this special file. Appending to a file in this manner performs better than using <a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a> in its 2-parameter mode because the file does not need to be closed and re-opened for each operation. Remember to include a newline (`n) after the text, if desired.</p>
<p class="calibre8 rm">To append in binary mode rather than text mode, prepend an asterisk to the filename. This causes each newline character (`n) to be written as as a single linefeed (LF) rather than the Windows standard of CR+LF. Example: *C:\My Unix File.txt.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">FutureUse</td>
<td class="calibre4">This parameter should be always left blank (omitted).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A file-read loop is useful when you want to operate each line contained in a text file, one at a time. It performs better than using <a href="#FileReadLine.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileReadLine</a> because: 1) the file can be kept open for the entire operation; and 2) the file does not have to be re-scanned each time to find the requested line number.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_LoopReadLine</strong> exists within any file-read loop. It contains the contents of the current line in the file. If an inner file-read loop is enclosed by an outer file-read loop, the innermost loop's file-line will take precedence.</p>
<p class="calibre8">Lines up to 65,534 characters long can be read. If the length of a line exceeds this, its remaining characters will be read during the next loop iteration.</p>
<p class="calibre8"><a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a> or a <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> is often used inside a file-read loop to parse the contents of each line retrieved from <em class="calibre21">InputFile</em>. For example, if <em class="calibre21">InputFile</em>'s lines are each a series of tab-delimited fields, those fields can individually retrieved as in this example:</p>
<pre class="calibre22">Loop, read, Database Export.txt
{
Loop, parse, A_LoopReadLine, %A_Tab%
{
MsgBox, Field number %a_index% is %A_LoopField%.
}
} </pre>
<p class="calibre8">See <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a> for information about <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, and the A_Index variable (which exists in every type of loop).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileReadLine.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileReadLine</a>, <a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a>, <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks, </a><a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Example #1: Only those lines of the 1st file that contain
; the word FAMILY will be written to the 2nd file. Uncomment
; this line to overwrite rather than append to any existing file:
;FileDelete, %A_Home%/Documents/Family Addresses.txt
Loop, read, %A_Home%/Documents/Address List.txt, %A_Home%/Documents/Family Addresses.txt
{
IfInString, A_LoopReadLine, family, FileAppend, %A_LoopReadLine%`n
}
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #2: A working script that attempts to extract all FTP and HTTP
; URLs from a text or HTML file:
FileSelectFile, SourceFile, 3,, Pick a text or HTML file to analyze.
if SourceFile =
return ; This will exit in this case.
SplitPath, SourceFile,, SourceFilePath,, SourceFileNoExt
DestFile = %SourceFilePath%\%SourceFileNoExt% Extracted Links.txt
IfExist, %DestFile%
{
MsgBox, 4,, Overwrite the existing links file? Press No to append to it.`n`nFILE: %DestFile%
IfMsgBox, Yes
FileDelete, %DestFile%
}
LinkCount = 0
Loop, read, %SourceFile%, %DestFile%
{
URLSearchString = %A_LoopReadLine%
Gosub, URLSearch
}
MsgBox %LinkCount% links were found and written to "%DestFile%".
return
URLSearch:
; It's done this particular way because some URLs have other URLs embedded inside them:
StringGetPos, URLStart1, URLSearchString, http://
StringGetPos, URLStart2, URLSearchString, ftp://
StringGetPos, URLStart3, URLSearchString, www.
; Find the left-most starting position:
URLStart = %URLStart1% ; Set starting default.
Loop
{
; It helps performance (at least in a script with many variables) to resolve
; "URLStart%A_Index%" only once:
StringTrimLeft, ArrayElement, URLStart%A_Index%, 0
if ArrayElement = ; End of the array has been reached.
break
if ArrayElement = -1 ; This element is disqualified.
continue
if URLStart = -1
URLStart = %ArrayElement%
else ; URLStart has a valid position in it, so compare it with ArrayElement.
{
if ArrayElement &lt;&gt; -1
if ArrayElement &lt; %URLStart%
URLStart = %ArrayElement%
}
}
if URLStart = -1 ; No URLs exist in URLSearchString.
return
; Otherwise, extract this URL:
StringTrimLeft, URL, URLSearchString, %URLStart% ; Omit the beginning/irrelevant part.
Loop, parse, URL, %A_Tab%%A_Space%&lt;&gt; ; Find the first space, tab, or angle (if any).
{
URL = %A_LoopField%
break ; i.e. perform only one loop iteration to fetch the first "field".
}
; If the above loop had zero iterations because there were no ending characters found,
; leave the contents of the URL var untouched.
; If the URL ends in a double quote, remove it. For now, StringReplace is used, but
; note that it seems that double quotes can legitimately exist inside URLs, so this
; might damage them:
StringReplace, URLCleansed, URL, ",, All
FileAppend, %URLCleansed%`n
LinkCount += 1
; See if there are any other URLs in this line:
StringLen, CharactersToOmit, URL
CharactersToOmit += %URLStart%
StringTrimLeft, URLSearchString, URLSearchString, %CharactersToOmit%
Gosub, URLSearch ; Recursive call to self.
return</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="SetWorkingDir.htm" href="#SetWorkingDir.htm">#</a> <h2 class="calibre17">SetWorkingDir</h2> [v1.0.11+]
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the script's current working directory. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetWorkingDir, DirName</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">DirName</td>
<td width="85%" class="calibre4">The name of the new working directory, which is assumed to be a subfolder of the current <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The script's working directory is the default directory that is used to access files and folders when an absolute path has not been specified. In the following example, the file <em class="calibre21"> My Filename.txt</em> is assumed to be in %A_WorkingDir%: <a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a>, A Line of Text, My Filename.txt</p>
<p class="calibre8">A script's initial working directory is determined by how it was launched. For example, if it was run via shortcut -- such as on the Start Menu -- its working directory is determined by the "Start in" field within the shortcut's properties.</p>
<p class="calibre8">Once changed, the new working directory is instantly and globally in effect throughout the script. All interrupted, <a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">paused</a>, and newly launched <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> are affected, including <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Timers</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetWorkingDir, D:\My Folder\Temp <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SplitPath.htm" href="#SplitPath.htm">#</a> <h2 class="calibre17">SplitPath</h2> [v1.0.15+]
<hr size="2" class="calibre24" />
<p class="calibre8">Separates a file name into its name, directory, extension, and drive.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">InputVar</td>
<td class="calibre4">Name of the variable containing the file name to be analyzed. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">OutFileName</td>
<td width="85%" class="calibre4">Name of the variable in which to store the file name without its path. The file's extension is included. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutDir</td>
<td class="calibre4">Name of the variable in which to store the directory of the file, including drive letter or share name (if present). The final backslash is not included even if the file is located in a drive's root directory.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutExtension</td>
<td class="calibre4">Name of the variable in which to store the file's extension (e.g. TXT, DOC, or EXE). The dot is not included.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutNameNoExt</td>
<td class="calibre4">Name of the variable in which to store the file name without its path, dot and extension.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutDrive</td>
<td class="calibre4">Name of the variable in which to store the drive letter or server name of the file. If the file is on a local or mapped drive, the variable will be set to the drive letter followed by a colon. If the file is on a network path (UNC), the variable will be set to the share name, e.g. \\Workstation01</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Any of the output variables may be omitted if the corresponding information is not needed.</p>
<p class="calibre8">If <em class="calibre21">InputVar</em> contains a filename with no path or just a relative path (e.g. Address List.txt), <em class="calibre21">OutDrive</em> will be made blank but all the other output variables will be set correctly. Similarly, if there is no path present, <em class="calibre21">OutDir</em> will be made blank; and if there is a path but no file name present, <em class="calibre21">OutFileName</em> and <em class="calibre21">OutNameNoExt</em> will be made blank.</p>
<p class="calibre8">Actual files and directories in the file system are not checked by this command. It simply analyzes the string given in <em class="calibre21">InputVar</em>.</p>
<p class="calibre8">Wildcards (* and ?) and other characters illegal in filenames are treated the same as legal characters, with the exception of colon, backslash, and period (dot), which are processed according to their nature in delimiting the drive letter, directory, and extension of the file.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">FullFileName = C:\My Documents\Address List.txt<br class="calibre12" />
<br class="calibre12" /> ; To fetch only the bare filename:<br class="calibre12" /> SplitPath, FullFileName, name<br class="calibre12" />
<br class="calibre12" /> ; Or, to fetch all info:<br class="calibre12" /> SplitPath, FullFileName, name, dir, ext, name_no_ext, drive<br class="calibre12" />
<br class="calibre12" /> ; The above will set the variables as follows:<br class="calibre12" /> ; name = Address List.txt<br class="calibre12" /> ; dir = C:\My Documents<br class="calibre12" /> ; ext = txt<br class="calibre12" /> ; name_no_ext = Address List<br class="calibre12" /> ; drive = C:
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="h_Include.htm" href="#h_Include.htm">#</a> <h2 class="calibre17">#Include / #IncludeAgain</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Causes the script to behave as though the specified file's contents are present.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#Include FileName<br class="calibre12" /> #IncludeAgain FileName </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td height="24" width="15%" class="calibre4">FileName</td>
<td width="85%" class="calibre4">The name of the file to be included, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. It <strong class="calibre14">must not</strong> contain double quotes, variable references (e.g. %ProgramFiles%), wildcards, or <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape sequences</a> (which are not needed since all characters are treated literally).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">#Include ensures that <em class="calibre21">FileName</em> is included only once, even if multiple inclusions are encountered for it. By contrast, #IncludeAgain allows multiple inclusions of the same file, while being the same as #Include in all other respects.</p>
<p class="calibre8">Lines displayed in the main window via <a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a> or the menu View-&gt;Lines are always numbered according to their physical order within their own files. In other words, including a new file will not change the line numbering of the main script file.</p>
<p class="calibre8">As with other # directives, this one cannot be executed conditionally. In other words, this example would not work:</p>
<pre class="calibre22">if x = 1
#Include SomeFile.ahk ; This is invalid.</pre>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> None</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p> #Include C:\My Documents\Scripts\Utility Subroutines.ahk ; Don't enclose in double quotes.<br class="calibre12" />
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Block.htm" href="#Block.htm">#</a> <h2 class="calibre17">{...} (block)</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Denotes a block. Blocks are typically used with <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a>, <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, and IF-commands.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4"> {<br class="calibre12" /> zero or more commands<br class="calibre12" /> }</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A block is used to bind two or more commands together. It can also be used to change which IF an <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ELSE</a> belongs to, as in this example where the block forces the <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ELSE</a> to belong to the first IF rather than the second:</p>
<pre class="calibre22">if var1 = 1
{
if var2 = abc
sleep, 1
}
else
return</pre>
<p class="calibre8">Although blocks can be used anywhere, currently they are only meaningful when used with <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a>, <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, or an IF-type command such as <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual</a> or <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>.</p>
<p class="calibre8">If an <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IF</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ELSE</a>, or <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a> has only a single command, that command need not be enclosed in a block. However, there may be cases where doing so enhances the readability or maintainability of the script.</p>
<p class="calibre8">A block may be empty (contain zero commands), which may be useful in cases where you want to comment out the contents of the block without removing the block itself.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a>, <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">if x = 1
{
MsgBox, test1
Sleep, 5
}
else
MsgBox, test2
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Break.htm" href="#Break.htm">#</a> <h2 class="calibre17">Break</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Exits (terminates) a <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a>. Valid only inside a <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Break</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None. <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The break command applies to the innermost loop in which it is enclosed. The use of break and <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">continue</a> are encouraged over <a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">goto</a> since they usually make scripts more readable and maintainable. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">loop
{
...
if var &gt; 25
break
...
if var &lt;= 5
continue
}
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Continue.htm" href="#Continue.htm">#</a> <h2 class="calibre17">Continue</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Skips the rest of the current <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a> iteration and begins a new one. Valid only inside a <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">loop</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Continue </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None. <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The continue command applies to the innermost loop in which it is enclosed. The use of <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> and continue are encouraged over <a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">goto</a> since they usually make scripts more readable and maintainable. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">; This example displays 5 MsgBoxes, one for each number between 6 and 10.
; Note that in the first 20 iterations of the Loop, the "continue" command
; causes the loop to start over before it reaches the MsgBox line.
Loop, 10
{
if A_Index &lt;= 5
continue
MsgBox, %A_Index%
}
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Else.htm" href="#Else.htm">#</a> <h2 class="calibre17">Else</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Specifies the command(s) to perform if an IF-command evaluates to FALSE.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Else</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Every use of this command must "belong to" (be associated with) an IF-command above it. An ELSE always belongs to the nearest unclaimed IF-command above it unless a <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">block</a> is used to change that behavior. An ELSE can be followed immediately by any other single command on the same line. This is most often used for "else if" ladders (see examples). </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8">See <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>. Also, every IF-command can use ELSE, including <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfMsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfMsgBox</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfBetween</a>, <a href="#IfIn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfIn</a>, and the <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IF command</a> itself.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">IfWinExist, Untitled - Notepad
{
WinActivate
Sleep, 1
}
else
{
WinActivate, Some Other Window
Sleep, 1
}
if x = 1
Gosub, a1
else if x = 2 ; "else if" style
Gosub, a2
else IfEqual, x, 3 ; alternate style
{
Gosub, a3
Sleep, 1
}
else Gosub, a4 ; i.e. Any single command can be on the same line with an ELSE.
;Also OK:
IfEqual, y, 1, Gosub, b1
else {
Sleep, 1
Gosub, b2
}</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Exit.htm" href="#Exit.htm">#</a> <h2 class="calibre17">Exit</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Exits the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> or (if the script is not <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a> contains no hotkeys) the entire script.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Exit [, ExitCode]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">ExitCode</td>
<td width="85%" class="calibre4">An integer (i.e. negative, positive, or zero) that is returned to its caller when the script exits. This code is accessible to any program that spawned the script, such as another script (via RunWait) or a batch (.bat) file. If omitted, ExitCode defaults to zero. Zero is traditionally used to indicate success. Note: Windows 95 may be limited in how large ExitCode can be.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If the script has no hotkeys, isn't <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a>, and hasn't requested the Num/Scroll/CapsLock key(s) to be kept AlwaysOn or AlwaysOff, it will terminate immediately when Exit is encountered (except if it has an <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a> subroutine).</p>
<p class="calibre8">Otherwise, the Exit command terminates the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>. In other words, the stack of subroutines called directly or indirectly by a <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">menu</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>, or <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> subroutine will all be returned from as though a <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a> were immediately encountered in each. If used directly inside such a subroutine -- rather than in one of the subroutines called indirectly by it -- Exit is equivalent to <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>.</p>
<p class="calibre8">Use <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> to completely terminate a script that is <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a> or contains hotkeys.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>, <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a>, <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#z::<br class="calibre12" /> Gosub, Sub2<br class="calibre12" /> MsgBox, This msgbox will never happen because of the EXIT.<br class="calibre12" /> return</p>
<p class="calibre8">Sub2:<br class="calibre12" /> Exit ; Terminate this subroutine as well as the calling subroutine.</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ExitApp.htm" href="#ExitApp.htm">#</a> <h2 class="calibre17">ExitApp</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Terminates the script unconditionally.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ExitApp [, ExitCode]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">ExitCode</td>
<td width="85%" class="calibre4">An integer (i.e. negative, positive, or zero) that is returned to its caller when the script exits. This code is accessible to any program that spawned the script, such as another script (via RunWait) or a batch (.bat) file. If omitted, ExitCode defaults to zero. Zero is traditionally used to indicate success. Note: Windows 95 may be limited in how large ExitCode can be.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The script is immediately terminated unless it has an <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a> subroutine. This is equivalent to choosing "Exit" from the script's tray menu or main menu. </p>
<p class="calibre8"><a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a> and ExitApp behave identically when the script contains no hotkeys, is not <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a>, and does not ask for the Num/Scroll/Capslock key(s) to be kept AlwaysOn or AlwaysOff.</p>
<p class="calibre8">If the script has an <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a> subroutine, it will be run in response to ExitApp.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a>, <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a>, <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#x::ExitApp ; Assign a hotkey to terminate this script. <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Gosub.htm" href="#Gosub.htm">#</a> <h2 class="calibre17">Gosub</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Jumps to the specified label and continues execution until <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a> is encountered.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Gosub, Label</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Label</td>
<td width="85%" class="calibre4">The name of the label or <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey label</a> to which to jump, which causes the commands beneath <em class="calibre21">Label</em> to be executed until a <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a> or <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a> is encountered. When that happens, the script jumps back to the first command beneath the Gosub and resumes execution there.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">As with the parameters of almost all other commands, <em class="calibre21">Label</em> can be a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> reference such as %MyLabel%, in which case the name stored in the variable is used as the target. However, performance might suffer slightly because the the target label must be "looked up" every time it is encountered rather than only once when the script is first loaded.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a>, <a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Goto</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Gosub, Label1 <br class="calibre12" /> MsgBox, The Label1 subroutine has returned (it is finished).<br class="calibre12" /> return</p>
<p class="calibre8"> </p>
<p class="calibre8">Label1:<br class="calibre12" /> MsgBox, The Label1 subroutine is now running.<br class="calibre12" /> return<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Goto.htm" href="#Goto.htm">#</a> <h2 class="calibre17">Goto</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Jumps to the specified label and continues execution.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Goto, Label</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Label</td>
<td width="85%" class="calibre4">The name of the label or hotkey label to which to jump.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The use of Goto is discouraged because it generally makes scripts less readable and harder to maintain. Consider using <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, and <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a> as substitutes for Goto. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Goto, MyLabel<br class="calibre12" /> ...<br class="calibre12" /> MyLabel:<br class="calibre12" /> Sleep, 100<br class="calibre12" /> ... <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Loop.htm" href="#Loop.htm">#</a> <h2 class="calibre17">Loop (normal) </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Perform a series of command repeatedly: either the specified number of times or until <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> is encountered.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Loop [, Count]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Count</td>
<td width="85%" class="calibre4">
<p class="calibre8">How many times (iterations) to perform the loop. If omitted or blank, the Loop is infinite (i.e. until a <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> or <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">return</a> is encountered). Unlike Repeat...EndRepeat, if <em class="calibre21">Count</em> is 0, zero iterations will be performed rather than an infinite number.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The loop command is usually followed by a <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">block</a>, which is a collection of statements that form the <em class="calibre21">body</em> of the loop. However, a loop with only a single command does not require a block (an if-else compound statement counts as a single command for this purpose). </p>
<p class="calibre8">The simplest use of this command is an infinite loop that uses the <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> command somewhere in the loop's <em class="calibre21">body</em> to determine when to stop the loop.</p>
<p class="calibre8">The use of <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> and <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">continue</a> inside a loop are encouraged as alternatives to <a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">goto</a>, since they generally make a script more understandable and maintainable. To create a "While" loop, make the first statement of the loop's <em class="calibre21">body</em> an IF statement that conditionally issues the <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">break</a> command. To create a "Do...While" loop, use the same technique except put the IF statement as the last statement in the loop's <em class="calibre21">body</em>.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_Index</strong> contains the number of the current loop iteration. For example, the first time the script executes the loop's <em class="calibre21">body</em>, this variable will contain the number 1. For the second time, it will contain 2, and so on. If an inner loop is enclosed by an outer loop, the inner loop takes precedence. The value will be <strong class="calibre14">0</strong> whenever the variable is referenced outside of a loop. This variable works inside all types of loops, including <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-loops</a> and <a href="#LoopReg.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">registry-loops</a>.</p>
<p class="calibre8">Specialized loops:<br class="calibre12" /> Loops can be used to automatically retrieve files, folders, or registry items (one at a time). See <a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-loop</a> and <a href="#LoopReg.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">registry-loop</a> for details. In addition, <a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">file-read loops</a> can operate on the entire contents of a file, one line at a time, and <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loops</a> can operate on the delimited substrings contained within a string, one field at a time.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#LoopFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File loop</a>, <a href="#LoopReg.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Registry loop</a>, <a href="#LoopReadFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">File-read loop</a>, <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Parsing loop</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">Loop, 3
{
MsgBox, Iteration number is %A_Index%. ; A_Index will be 1, 2, then 3
Sleep, 100
}
Loop
{
if a_index &gt; 25
break ; Terminate the loop
if a_index &lt; 20
continue ; Skip the below and start a new iteration
MsgBox, a_index = %a_index% ; This will display only the numbers 20 through 25
}
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="LoopParse.htm" href="#LoopParse.htm">#</a> <h2 class="calibre17">Loop (parse a string) </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves substrings (fields) from a string, one by one.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4"> Loop, Parse, InputVar [, Delimiters, OmitChars, FutureUse] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Parse</td>
<td width="85%" class="calibre4">This parameter must be the word PARSE<span class="rm">, and unlike other loop types, it must not be a variable reference that resolves to the word PARSE.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">InputVar</td>
<td class="calibre4">
<p class="calibre8">The name of the variable whose contents will be analyzed. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Delimiters</td>
<td class="calibre4">
<p class="calibre8">If this parameter is blank or omitted, each character of <em class="calibre21">InputVar</em> will be treated as a separate substring.</p>
<p class="calibre8 tbd">In v1.0.09+, if this parameter is <strong class="calibre14">CSV</strong>, <em class="calibre21">InputVar</em> will be parsed in standard comma separated value format. Here is an example of a CSV line produced by MS Excel: "first field",SecondField,"the word ""special"" is quoted literally",,"last field, has literal comma"</p>
<p class="calibre8">Otherwise, <em class="calibre21">Delimiters</em> contains one or more characters (case sensitive) used to determine where the boundaries between substrings occur in <em class="calibre21">InputVar</em>.</p>
<p class="calibre8">Delimiter characters are not considered to be part of the substrings themselves. In addition, if there is nothing between a pair of delimiters within <em class="calibre21">InputVar</em>, the corresponding substring will be empty.</p>
<p class="calibre8">For example: `, (an escaped comma) would divide the string based on every occurrence of a comma. Similarly, %A_Tab%%A_Space% would start a new substring every time a space or tab is encountered in <em class="calibre21">InputVar</em>.</p>
<p class="calibre8">To use a string as a delimiter rather than a character, first use <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a> to replace all occurrences of the string with a single character that is never used literally in the text, e.g. one of these special characters: ¢¤¥¦§©ª«®µ¶. Consider this example, which uses the string &lt;br&gt; as a delimiter:<br class="calibre12" /> StringReplace, NewHTML, HTMLString, &lt;br&gt;, ¢, All ; Replace each &lt;br&gt; with a cent symbol. <br class="calibre12" /> Loop, parse, NewHTML, ¢ ; Parse the string based on the cent symbol.<br class="calibre12" /> {<br class="calibre12" /> ...<br class="calibre12" /> } </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OmitChars</td>
<td class="calibre4">
<p class="calibre8">An optional list of characters (case sensitive) to exclude from the beginning and end of each substring. For example, if <em class="calibre21">OmitChars</em> is %A_Space%%A_Tab%, spaces and tabs will be removed from the beginning and end (but not the middle) of every retrieved substring.</p>
<p class="calibre8">If <em class="calibre21">Delimiters</em> is blank, <em class="calibre21">OmitChars</em> indicates which characters should be excluded from consideration (the loop will not see them).</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">FutureUse</td>
<td class="calibre4">This parameter should be always left blank (omitted).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A string parsing loop is useful when you want to operate on each field contained in a string, one at a time. Parsing loops use less memory than <a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a> (since StringSplit creates a permanent array) and in most cases they are easier to use.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_LoopField</strong> exists within any parsing loop. It contains the contents of the current substring (field) from <em class="calibre21">InputVar</em>. If an inner parsing loop is enclosed by an outer parsing loop, the innermost loop's field will take precedence.</p>
<p class="calibre8">There is no restriction on the size of <em class="calibre21">InputVar</em> or its fields. In addition, if <em class="calibre21">InputVar</em>'s contents change during the execution of the loop, the loop will not "see" the changes because it is operating on a temporary copy of the original contents.</p>
<p class="calibre8">To arrange the fields in a different order prior to parsing, use the <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a> command. </p>
<p class="calibre8">See <a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loop</a> for information about <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, and the A_Index variable (which exists in every type of loop).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a><a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">, Loop</a>, <a href="#Break.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Break</a>, <a href="#Continue.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Continue</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a>, <a href="#FileSetAttrib.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetAttrib</a>, <a href="#FileSetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSetTime</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Example #1:
Colors = red,green,blue
Loop, parse, Colors, `,
{
MsgBox, Color number %a_index% is %A_LoopField%.
}
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #2: This one is useful whenever the clipboard contains
; files (such as those copied from an open Explorer window).
; The program automatically converts such files to their file names.
Loop, parse, clipboard, `n, `r
{
MsgBox, 4, , File number %a_index% is %A_LoopField%.`n`nContinue?
IfMsgBox, No, break
}
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #3: Parse a comma separated value (CSV) file:
Loop, read, C:\Database Export.csv
{
LineNumber = %A_Index%
Loop, parse, A_LoopReadLine, CSV
{
MsgBox, 4, , Field %LineNumber%-%A_Index% is:`n%A_LoopField%`n`nContinue?
IfMsgBox, NO, return
}
}</pre>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="LoopReg.htm" href="#LoopReg.htm">#</a> <h2 class="calibre17">Loop (registry)</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the contents of the specified registry subkey, one item at a time.</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="OnExit.htm" href="#OnExit.htm">#</a> <h2 class="calibre17">OnExit</h2> [v1.0.13+]
<hr size="2" class="calibre24" />
<p class="calibre8">Specifies a subroutine to run when the script exits.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">OnExit [, Label, FutureUse]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Label</td>
<td width="85%" class="calibre4">
<p class="calibre8">If omitted, the script is returned to its normal exit behavior. Otherwise, this parameter is the label name whose contents will be executed (as a new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a>) when the script exits by any means. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">FutureUse</td>
<td class="calibre4">The parameter should always be omitted. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Since the specified subroutine is called instead of terminating the script, <strong class="calibre14">that subroutine must use the <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> command if termination is desired.</strong> Alternatively (as in the Examples section below), the OnExit subroutine might display a <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> to prompt the user for confirmation -- and only if the user presses YES will the script be terminated.</p>
<p class="calibre8">The OnExit subroutine is called when the script exits by any means (except when it is killed by something like "End Task"). It is also called whenever the <a href="#h_SingleInstance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#SingleInstance</a> and <a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a> commands ask a previous instance to terminate.</p>
<p class="calibre8">The OnExit <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> does not obey <a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a> (it will always launch when needed). In addition, while it is running, it cannot be interrupted by <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu items</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed subroutines</a>. However, it will be interrupted (and the script will terminate) if the user chooses Exit from the tray menu or main menu, or the script is asked to terminate as a result of <a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a> or <a href="#h_SingleInstance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#SingleInstance</a>. Because of this, the OnExit subroutine should be designed to finish quickly unless the user is aware of what it is doing.</p>
<p class="calibre8">If the OnExit <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> encounters a failure condition such as a runtime error, the script will terminate. This prevents a flawed OnExit subroutine from making a script impossible to terminate.</p>
<p class="calibre8">If the OnExit subroutine was launched due to an <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a> or <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> command that specified an exit code, that code is ignored and no longer available. A new exit code can be specified by the OnExit subroutine if/when it calls <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>.</p>
<p class="calibre8">Whenever the OnExit subroutine is called by an exit attempt, it starts off fresh with the default values for settings such as <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>. These defaults can be changed in the <a href="#Scripts.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">auto-execute section</a>.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_ExitReason </strong>is blank unless the OnExit subroutine is currently running or has been called at least once by a prior exit attempt. If not blank, it is one of the following words:</p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Logoff</td>
<td class="calibre4">The user is logging off.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Shutdown</td>
<td class="calibre4">The system is being shut down or restarted, such as by the <a href="#Shutdown.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Shutdown</a> command. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Close</td>
<td class="calibre4">The script was sent a WM_CLOSE or WM_QUIT message, had a critical error, or is being closed in some other way. Although all of these are unusual, WM_CLOSE might be caused by <a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a> having been used on the script's main window. To prevent this, dismiss the main window with <em class="calibre21">Send, !{F4}</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Error</td>
<td class="calibre4">A runtime error occurred in a script that has no hotkeys and that is not <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a>. An example of a runtime error is <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run/RunWait</a> being unable to launch the specified item.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Menu</td>
<td class="calibre4">The user selected Exit from the main window's menu or from the standard tray menu.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Exit</td>
<td class="calibre4">The <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a> or <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> command was used (includes <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu items</a>). </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Reload</td>
<td class="calibre4">The script is being reloaded via the <a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a> command or menu item.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Single</td>
<td class="calibre4">The script is being replaced by a new instance of itself as a result of <a href="#h_SingleInstance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#SingleInstance</a>. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>, <a href="#Shutdown.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Shutdown</a>, <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">#Persistent ; For demonstration purposes.
OnExit, ExitSub
return
ExitSub:
if A_ExitReason not in Logoff,Shutdown ; Avoid spaces around comma.
{
MsgBox, 4, , Are you sure you want to exit?
IfMsgBox, No, return
}
ExitApp</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Pause.htm" href="#Pause.htm">#</a> <h2 class="calibre17">Pause</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Pauses the script's <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Pause [, On|Off|Toggle]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">On|Off|Toggle</td>
<td width="85%" class="calibre4">On: Pauses the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>. <br class="calibre12" /> Off: Unpauses <span class="rm">the most recently</span> <span class="x11">the underlying</span> paused <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> thread</a>. <br class="calibre12" /> Toggle (default): Changes to the opposite of its previous state (On or Off). </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> Unlike <a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Suspend</a> -- which disables hotkeys -- pause will freeze the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> (and as a result, all interrupted threads beneath it will lie dormant).</p>
<p class="calibre8">New hotkeys can still be launched while the script is paused, but when their <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> finish, the underlying interrupted thread will still be paused. In other words, each thread can be paused independently of the others.</p>
<p class="calibre8"><span class="tbd">The color of the tray icon changes from green to red</span> <span class="x11">The icon changes to a loading symbol</span> whenever the script's <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> is in a paused state.</p>
<p class="calibre8">This command mirrors the function of the "Pause Script" tray menu item.</p>
<p class="calibre8"><span class="tbd">A script is always halted (though not officially paused) while its tray menu or main window's menu is displayed.</span></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Suspend</a>, <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Pause::Pause ; Assign the toggle-pause function to the "pause" key.</p>
<p class="calibre8">#p::Pause ; Or assign it to Win+p or some other hotkey. </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Return.htm" href="#Return.htm">#</a> <h2 class="calibre17">Return</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Returns from a subroutine to which execution had previously jumped via <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a> activation, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, or other means. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Return</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Due to its hotkey nature, if there is no caller to which to return, Return will do an <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a>, <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#z::<br class="calibre12" /> MsgBox, The Win-Z hotkey was pressed.<br class="calibre12" /> Gosub, WinZ <br class="calibre12" /> return<br class="calibre12" />
<br class="calibre12" /> WinZ:<br class="calibre12" /> Sleep, 1000<br class="calibre12" /> return<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetBatchLines.htm" href="#SetBatchLines.htm">#</a> <h2 class="calibre17">SetBatchLines</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Determines how fast a script will run (affects CPU utilization).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetBatchLines, 20ms<br class="calibre12" /> SetBatchLines, LineCount </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">20ms</td>
<td width="85%" class="calibre4">(The 20ms is just an example). If the value ends in ms, it indicates how often the script should sleep (each sleep is 10 ms long). In the following example, the script will sleep for 10ms every time it has run for 20ms: SetBatchLines, 20ms </td>
</tr>
<tr class="calibre3">
<td class="calibre4">LineCount</td>
<td class="calibre4">The number of script lines to execute prior to sleeping for 10ms. The value can be as high as 9223372036854775807, or use a value of -1 to never sleep (i.e. run at maximum speed).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If this command is not used:</p>
<ul class="calibre10">
<li class="calibre11">Default to <em class="calibre21">SetBatchLines 10ms</em> except in versions prior to v1.0.16, which use 10 (lines) instead.</li>
</ul>
<p class="calibre8">The "ms" method is recommended for scripts whenever speed and cooperation are important. For example, on most systems a setting of 10ms will prevent the script from using any more than 50% of an idle CPU's time. This allows scripts to run quickly while still maintaining a high level of cooperation with CPU sensitive tasks such as games and video capture/playback.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_BatchLines</strong> contains the current setting.</p>
<p class="calibre8">The speed of a script can also be impacted by the following commands, depending on the nature of the script: <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a>, and <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a>.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a>, <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> </p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetBatchLines, 10ms </p>
<p class="calibre8">SetBatchLines, 1000</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="SetTimer.htm" href="#SetTimer.htm">#</a> <h2 class="calibre17">SetTimer</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Causes a subroutine to be launched automatically and repeatedly at a specified time interval.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetTimer, Label [, Period|On|Off, Priority]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Label</td>
<td width="85%" class="calibre4">The name of the label or <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey label</a> to which to jump, which causes the commands beneath <em class="calibre21">Label</em> to be executed until a <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a> or <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a> is encountered. As with the parameters of almost all other commands, <em class="calibre21">Label</em> can be a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> reference such as %MyLabel%, in which case the name stored in the variable is used as the target.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Period|On|Off</td>
<td class="calibre4">
<p class="calibre8"><strong class="calibre14">On</strong>: Re-enables a previously disabled timer at its former <em class="calibre21">period</em>. If the timer doesn't exist, it is created (with a default period of 250).</p>
<p class="calibre8"><strong class="calibre14">Off</strong>: Disables an existing timer.</p>
<p class="calibre8"><strong class="calibre14">Period</strong>: Creates or updates a timer using this parameter as the number of milliseconds that must pass since the last time the <em class="calibre21">Label</em> subroutine was started. When this amount of time has passed, <em class="calibre21">Label</em> will be run again (unless it is still running from the last time). The timer will be automatically enabled. To prevent this, call the command a second time immediately afterward, specifying OFF for this parameter.</p>
<p class="calibre8">If blank and:<br class="calibre12" /> 1) the timer does not exist: it will be created with a period of 250.<br class="calibre12" /> 2) the timer already exists: it will be enabled and <a href="#SetTimer.htm__reset" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">reset</a> at its former <em class="calibre21">period</em> unless a <em class="calibre21">Priority</em> is specified.<br class="calibre12" />
</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Priority</td>
<td class="calibre4">
<p class="calibre8">In v1.0.16+, this optional parameter is an integer between -2147483648 and 2147483647 to indicate this timer's thread priority. If omitted, 0 will be used. See <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a> for details.</p>
<p class="calibre8">To change the priority of an existing timer without affecting it in any other way, leave the parameter before this one blank.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Timers are useful because they run asynchronously, meaning that they will run at the specified frequency (interval) even when the script is waiting for a window, displaying a dialog, or busy with another task. Examples of their many uses include taking some action when the user becomes idle (as reflected by <a href="#Variables.htm__TimeIdle" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_TimeIdle%</a>) or closing unwanted windows the moment they appear.</p>
<p class="calibre8">Although timers may give the illusion that the script is performing more than one task simultaneously, this is not the case. Instead, timed subroutines are treated just like other threads: they can interrupt or be interrupted by another thread, such as a <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey subroutine</a>. See <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a> for details.</p>
<p class="calibre8">Whenever a timer is enabled, re-enabled, or updated with a new <em class="calibre21">period,</em> it will not run right away; its time <em class="calibre21">period</em> must expire first. If you wish the timer's first first execution to be immediate, use the <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a> command immediately after the SetTimer command.</p>
<p class="calibre8"><a id="SetTimer.htm__reset" href="#SetTimer.htm__reset" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Similarly, if SetTimer is used on an existing timer and parameter #2 is a number or the word ON, the timer's internal "time of last run" will be reset to the current time; in other words, the entirety of its period must elapse before it will run again. An easy way to reset a timer is to omit all parameters except the first. Example: <em class="calibre21">SetTimer, TimerName</em> </p>
<p class="calibre8"><span class="rm">Currently, timers cannot run much more often than every 10ms on Windows XP/2000/NT and about 55ms on Windows 9x. Specifying a <em class="calibre21">Period</em> less than this will usually result in an actual interval of 10 or 55 (but this behavior may change in future versions so shouldn't be relied upon).</span></p>
<p class="calibre8">Timers with very short <em class="calibre21">periods</em> might not be able to run as often as expected if the current setting of <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a> restricts the speed of the script too much. Similarly, if the total number of lines to be executed in all timed subroutines is large, you may need to alter <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a> to allow them to run as often as specified.</p>
<p class="calibre8">In addition, a timer might not be able to run as often as specified under the following conditions:</p>
<ol class="calibre19">
<li class="calibre11">Other applications are putting a heavy load on the CPU.</li>
<li class="calibre11"> The timer subroutine itself takes longer than its own <em class="calibre21">period</em> to run, or there are too many other competing timers (altering <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a> may help).</li>
<li class="calibre11">The timer has been interrupted by another <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a>, namely another timed subroutine, <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey subroutine</a>, or <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>. If this happens and the interrupting thread takes a long time to finish, the interrupted timer will be effectively disabled for the duration. However, any other timers will continue to run by interrupting the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> that interrupted the first timer.</li>
</ol>
<p class="calibre8">Because timers operate by temporarily interrupting the script's current activity, their subroutines should be kept short (so that they finish quickly) whenever a long interruption would be undesirable.</p>
<p class="calibre8">Timers that stay in effect for the duration of a script should usually be created in the <a href="#Scripts.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">auto-execute section</a>. By contrast, a temporary timer might often be disabled by its own subroutine (see the examples).</p>
<p class="calibre8">Whenever a timed subroutine is run, it starts off fresh with the default values for settings such as <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>. These defaults can be changed in the <a href="#Scripts.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">auto-execute section</a>.</p>
<p class="calibre8">Although timers will operate when the script is <a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">suspended</a>, they will not run whenever <u class="calibre20">any</u> <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> is <a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">paused</a>. In addition, they do not operate when the user is navigating through the tray icon menu or the main window's menu.</p>
<p class="calibre8">If <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> response time is critical (such as in games) and the script contains any timers whose subroutines take longer than about 5 ms to execute, use the following command to avoid any chance of a 15 ms delay. Such a delay would otherwise happen if a hotkey is pressed at the exact moment a timer thread is in its period of uninterruptibility: <a href="#Thread.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Thread</a>, interrupt, 0 ; Make all threads always-interruptible.</p>
<p class="calibre8">If a timer is disabled while its subroutine is currently running, that subroutine will continue until it completes.</p>
<p class="calibre8">The <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a> feature shows how many timers exist and how many are currently enabled.</p>
<p class="calibre8">To keep a non-hotkey script running -- such as one that contains only timers -- use <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#Thread.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Thread</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Example #1: Close unwanted windows whenever they appear:
SetTimer, CloseMailWarnings, 250
return
CloseMailWarnings:
WinClose, Microsoft Outlook, A timeout occured while communicating
WinClose, Microsoft Outlook, A connection to the server could not be established
return
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #2: Wait for a certain window to appear and then alert the user:
SetTimer, Alert1, 500
return
Alert1:
IfWinNotExist, Video Conversion, Process Complete
return
; Otherwise:
SetTimer, Alert1, Off ; i.e. the timer turns itself off here.
SplashTextOn, , , The video conversion is finished.
Sleep, 3000
SplashTextOff
return
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #3: Detection of single, double, and triple-presses of a hotkey. This
; allows a hotkey to perform a different operation depending on how many times
; you press it:
#c::
if winc_presses &gt; 0 ; SetTimer already started, so we log the keypress instead.
{
winc_presses += 1
return
}
; Otherwise, this is the first press of a new series. Set count to 1 and start
; the timer:
winc_presses = 1
SetTimer, KeyWinC, 400 ; Wait for more presses within a 400 millisecond window.
return
KeyWinC:
SetTimer, KeyWinC, off
if winc_presses = 1 ; The key was pressed once.
{
Run, m:\ ; Open a folder.
}
else if winc_presses = 2 ; The key was pressed twice.
{
Run, m:\multimedia ; Open a different folder.
}
else if winc_presses &gt; 2
{
MsgBox, Three or more clicks detected.
}
; Regardless of which action above was triggered, reset the count to
; prepare for the next series of presses:
winc_presses = 0
return</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Sleep.htm" href="#Sleep.htm">#</a> <h2 class="calibre17">Sleep</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits the specified amount of time before continuing. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Sleep, Delay</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Delay</td>
<td width="85%" class="calibre4">
<p class="calibre8">The amount of time to pause (in milliseconds) between 0 and 2147483647 (24 days).</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"><span class="rm">Due to the granularity of the OS's time-keeping system, <em class="calibre21">Delay</em> might be rounded up to the nearest multiple of 10. For example, a delay between 1 and 10 (inclusive) is equivalent to 10 on Windows XP (and probably NT &amp; 2k).</span></p>
<p class="calibre8">The actual delay time may wind up being longer than what was requested if the CPU is under load.</p>
<p class="calibre8">A delay of 0 will yield the remainder of the script's current timeslice to any other processes that need it, in which case an actual delay between 0 and 20ms (or more) may occur. If there are no needy processes, there will be no delay at all. However, a <em class="calibre21">Delay</em> of 0 should always wind up being shorter on most OSes than any longer <em class="calibre21">Delay</em> would have been.</p>
<p class="calibre8">While sleeping, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> Sleep, 1000 ; 1 second</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Suspend.htm" href="#Suspend.htm">#</a> <h2 class="calibre17">Suspend</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Disables all or selected <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Suspend [, Mode]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Mode</td>
<td width="85%" class="calibre4">
<p class="calibre8">On: Suspends all hotkeys except those explained the the Remarks section.</p>
<p class="calibre8">Off: Re-enables all hotkeys.</p>
<p class="calibre8">Toggle (default): Changes to the opposite of its previous state (On or Off).</p>
<p class="calibre8 tbd">Permit: Does nothing except mark the current subroutine as being exempt from suspension.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Any hotkey subroutine whose first line is Suspend -- <span class="tbd">except "Suspend, on" (in v1.0.07+)</span> -- 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>
<p class="calibre8">Suspending a script's hotkeys does not stop the script's already-running <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> (if any); use <a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Pause</a> to do that.</p>
<p class="calibre8">When a script's hotkeys are suspended, <span class="tbd">its tray icon changes to the letter S.</span> <span class="x11">The icon changes to a keyboard symbol.</span></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Pause</a>, <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">^!s::Suspend ; Assign the toggle-suspend function to a hotkey.</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Gui.htm" href="#Gui.htm">#</a> <h2 class="calibre17">GUI</h2> [v1.0.19+]
<hr size="2" class="calibre24" />
<p class="calibre8">Creates and manages windows and controls. Such windows can be used as data entry forms or custom user interfaces.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GUI, sub-command [, Param2, Param3, Param4]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17">Table of Contents</span></p>
<ul class="calibre10">
<li class="calibre11"><a href="#Gui.htm__Menu" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>: Adds or removes a menu bar. </li>
<li class="calibre11"><a href="#Gui.htm__Color" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Color</a>: Sets the background color for the window and/or its controls.</li>
<li class="calibre11"><a href="#Gui.htm__Font" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Font</a>: Sets the typeface, size, style, and text color for subsequently created controls.</li>
<li class="calibre11"><a href="#Gui.htm__Options" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Options</a>: Sets various options for the appearance and behavior of the window.</li>
<li class="calibre11"><a href="#Gui.htm__Flash" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Flash</a>: Blinks the window and its taskbar button.</li>
<li class="calibre11"><a href="#Gui.htm__Show" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Show</a>: Displays the window.</li>
<li class="calibre11"><a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Submit</a>: Saves the user's input and optionally hides the window. </li>
<li class="calibre11"><a href="#Gui.htm__Cancel" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Cancel</a>: Hides the window.</li>
<li class="calibre11"><a href="#Gui.htm__Destroy" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Destroy</a>: Deletes the window.</li>
<li class="calibre11"><a href="#Gui.htm__Default" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Default</a>: Changes the current thread's default GUI window number. </li>
<li class="calibre11"><a href="#Gui.htm__Add" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Add</a>: Creates a control. Click one of the following types for details: <ul class="calibre13">
<li class="calibre11"><a href="#Gui.htm__Text" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Text</a>, <a href="#Gui.htm__Edit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Edit</a>, <a href="#Gui.htm__Hotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a>, <a href="#Gui.htm__Picture" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Picture</a></li>
<li class="calibre11"><a href="#Gui.htm__GroupBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupBox</a>, <a href="#Gui.htm__Button" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Button</a>, <a href="#Gui.htm__Checkbox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Checkbox</a>, <a href="#Gui.htm__Radio" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Radio</a></li>
<li class="calibre11"><a href="#Gui.htm__DropDownList" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DropDownList</a>, <a href="#Gui.htm__ComboBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ComboBox</a>, <a href="#Gui.htm__ListBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListBox</a></li>
<li class="calibre11"><a href="#Gui.htm__Slider" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Slider</a>, <a href="#Gui.htm__Progress" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>, <a href="#Gui.htm__Tab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Tab</a></li>
</ul>
</li>
<li class="calibre11"><a href="#Gui.htm__Position" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Positioning and sizing of controls</a></li>
<li class="calibre11"><a href="#Gui.htm__Events" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Acting upon user input</a>: Variables and G-Labels</li>
<li class="calibre11"><a href="#Gui.htm__OtherOptions" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Other options and styles</a></li>
<li class="calibre11"><a href="#Gui.htm__Remarks" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Remarks</a></li>
<li class="calibre11"><a href="#Gui.htm__Examples" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Examples</a></li>
</ul>
<p class="calibre8"> </p>
<div class="tbd">
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Menu" href="#Gui.htm__Menu" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Menu [, MenuName]</span></p>
<p class="calibre8">Attaches a menu bar to the window. Use the <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a> command to create an ordinary menu for this purpose. To remove a window's current menu bar, omit the <em class="calibre21">MenuName</em> parameter.</p>
<p class="calibre8">Once a menu has been used as a menu bar, it should not be used as a popup menu or a submenu. This is because menu bars internally require a different format (note: this restriction applies only to the menu bar itself, not its submenus). If you need to work around this, create one menu to use as the menu bar and another identical menu to use as a popup menu or submenu.</p>
<p class="calibre8">The use of certain destructive <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">menu sub-commands</a> such as Delete and DeleteAll against a menu that is currently being used as a menu bar will not succeed (a warning dialog is displayed unless the <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">UseErrorLevel</a> setting is in effect). To make such changes: 1) detach the menu bar (see above); 2) make the changes; 3) reattach the menu bar. This restriction does not apply to the menu bar's submenus.</p>
<p class="calibre8"> </p>
</div>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Color" href="#Gui.htm__Color" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Color [, WindowColor, ControlColor]</span></p>
<p class="calibre8">Sets the background color of the window and/or its controls. <em class="calibre21">ControlColor</em> is applied to all present and future controls in the window (with the exception of a few types that do not support a custom color).</p>
<p class="calibre8">Leave either parameter blank to retain the current color. Otherwise, specify one of the 16 primary <a href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">HTML color names</a> or a 6-digit RGB color value (the 0x prefix is optional), or specify the word Default to return either to its default color. Example values: Silver, FFFFAA, 0xFFFFAA, Default</p>
<p class="calibre8">By default, the window's background color is the system's color for the face of buttons, and the controls' background color is the system's default window color (usually white).</p>
<p class="calibre8">The color of the menu bar and its submenus can be changed as in this example: <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, MyMenuBar, Color, White</p>
<p class="calibre8">To make the background transparent, use <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet TransColor</a>. <span class="rm">However, if you do this without first having assigned a custom window via "Gui, Color", buttons will also become transparent. To prevent this,</span> first assign a custom color and then make that color transparent as in this example:<br class="calibre12" /> Gui, Color, EEAA99<br class="calibre12" /> WinSet, TransColor, EEAA99, My Window Title ; But first turn <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> on if needed.</p>
<p class="calibre8">To additionally remove the border and title bar from a window with a transparent background, use the following <em class="calibre21">after</em> the window has been made transparent:<br class="calibre12" /> Gui, -Caption ; Or use "Gui, 2:-Caption" if it is the second window, etc.</p>
<p class="calibre8">To illustrate the above, there is an example of an on-screen display (OSD) at the bottom of this page.</p>
<p class="calibre8"> </p>
<div class="tbd">
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Font" href="#Gui.htm__Font" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Font [, Options, FontName]</span></p>
<p class="calibre8">Sets the font typeface, size, style, and/or color for controls created from this point onward.</p>
<p class="calibre8">Omit both parameters to restore the font to the system's default GUI typeface, size, and color. </p>
<p class="calibre8"><em class="calibre21">FontName</em> may be the name of any font, such as one from the <a href="#FontsStandard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">font table</a>. If <em class="calibre21">FontName</em> is omitted or does not exist on the system, the previous font's typeface will be used (or if none, the system's default GUI typeface). This behavior is useful to make a GUI window have a similar font on multiple systems, even if some of those systems lack the preferred font. For example, by using the following commands in order, Verdana will be given preference over Arial, which in turn is given preference over MS sans serif:<br class="calibre12" /> gui, font,, MS sans serif<br class="calibre12" /> gui, font,, Arial<br class="calibre12" /> gui, font,, Verdana ; Preferred font. </p>
<p class="calibre8">If the <em class="calibre21">Options</em> parameter is blank, the previous font's attributes will be used. Otherwise, specify one or more of the following option letters as substitutes:</p>
<p class="calibre8"><strong class="calibre14">C</strong>: Color name (see <a href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">color chart</a>) or RGB value -- or specify the word Default to return to the system's default color (black on most systems). Example values: cRed, cFFFFAA, cDefault. Note: An individual control can be created with a font color other than the current one by including the C option. Example: "Gui, add, text, cRed, My Text" </p>
<p class="calibre8"><strong class="calibre14">S</strong>: Size (in points). Example: s10</p>
<p class="calibre8"><strong class="calibre14">W</strong>: Weight (boldness), which is a number between 1 and 1000 (400 is normal and 700 is bold). Example: w600</p>
<p class="calibre8">The following words are also supported: <strong class="calibre14">bold</strong>, <em class="calibre21">italic</em>, <s class="calibre29">strike</s>, <u class="calibre20">underline</u>, and norm. <em class="calibre21">Norm</em> returns the font to normal weight/boldness and turns off italic, strike, and underline (but it retains the existing color and size). It is possible to use norm to turn off all attributes and then selectively turn on others. In the following example, the font is set to normal and then to italic: norm italic </p>
<p class="calibre8">To specify more than one option, include a space between each. Example: cBlue s12 bold</p>
<p class="calibre8">If a script creates multiple GUI windows (see remarks section), each window remembers its own "current font" for the purpose of creating more controls.</p>
<p class="calibre8"> </p>
</div>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Options" href="#Gui.htm__Options" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> +/-Option1 +/-Option2 ... </span></p>
<p class="calibre8">One or more options may be specified immediately after the GUI command. <span class="rm">For performance reasons, it is better to do this before creating the window; that is, before any use of other sub-commands such as "Gui Add".</span></p>
<p class="calibre8">The effect of this command is cumulative; that is, it alters only those settings that are explicitly specified, leaving all the others unchanged.</p>
<p class="calibre8">Specify a plus sign to add the option and a minus sign to remove it. Example:<br class="calibre12" /> Gui, -resize +owner ; Change the current/default GUI window.<br class="calibre12" /> Gui, 2:-resize +owner ; Change the second GUI window.</p>
<p class="calibre8">Options other than Resize and Owner require version 1.0.21 or greater.</p>
<p class="calibre8 rbd"> <strong class="calibre14">Border</strong>: Provides a thin-line border around the window. This is not common.</p>
<p class="calibre8"><strong class="calibre14">Caption</strong>: Provides a title bar and a thick window border/edge. [Default]</p>
<p class="calibre8"><strong class="calibre14">MaximizeBox</strong>: Enables the maximize button in the title bar. This is also included as part of <em class="calibre21">Resize</em> below. <span class="x11">MinimizeBox and MaximizeBox can only be used together. They only work before you have run Gui, Show.</span></p>
<p class="calibre8"><strong class="calibre14">MinimizeBox</strong>: Enables the minimize button in the title bar. [Default] <span class="x11">MinimizeBox and MaximizeBox can only be used together. They only work before you have run Gui, Show.</span></p>
<p class="calibre8 tbd"><strong class="calibre14">Owner</strong>: Use +owner to make the window owned by another (but once the window is created, -owner has no effect). An owned window has no taskbar button by default, and when visible it is always on top of its owner. It is also automatically destroyed when its owner is destroyed.</p>
<p class="calibre8 tbd">This option must be used <u class="calibre20">after</u> the window's owner is created but <u class="calibre20">before</u> the owned is created (via a command such as "Gui Add"). There are two ways to use +owner as shown in these examples:<br class="calibre12" /> gui, 2:+owner1 ; Make #2 window owned by #1 window.<br class="calibre12" /> gui, +owner ; Make #1 window owned by script's main window.</p>
<p class="calibre8 tbd">On a related note, to temporarily prevent the user from interacting with a window -- such as while one of its owned windows is visible -- disable the window via "Gui, 1:+0x8000000". To re-enable it later, use "Gui, 1:-0x8000000" followed by "Gui, 1:Show".</p>
<p class="calibre8"><strong class="calibre14">Resize</strong>: Makes the window resizable and enables its maximize button in the title bar. To avoid enabling the maximize button, specify "+Resize -MaximizeButton".</p>
<p class="calibre8 tbd"><strong class="calibre14">SysMenu</strong>: Provides an icon with a drop-down menu in the upper left corner of the title bar. [Default]</p>
<p class="calibre8 rm"><strong class="calibre14">Theme</strong>: By specifying -Theme, all subsequently created controls in the window will have Classic Theme appearance on Windows XP and beyond. To later create additional controls in the window that obey the current theme, turn it back on via +Theme. Note: This option has no effect on operating systems older than Windows XP, nor does it have any effect on XP itself if the Classic Theme is in effect.</p>
<p class="calibre8"><strong class="calibre14">ToolWindow</strong>: Provides <span class="rm">a narrower title bar</span> but the window will have no taskbar button.</p>
<p class="calibre8"><strong class="calibre14">(Unnamed Style)</strong>: Specify a plus or minus sign followed immediately by a decimal or hexadecimal <a href="#Styles.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">style number</a>. You can find a list of Styles with their respective numbers <a href="https://learn.microsoft.com/en-us/windows/win32/winmsg/window-styles">here</a>. <span class="x11">Currently, only one code is supported: WS_POPUP (Gui, +0x80000000). This prevents the window from ever grabbing focus. This option only works when you specify it before any other Gui command as the type can only be set at internal window creation time.</span></p>
<p class="calibre8"><strong class="calibre14">(Unnamed ExStyle)</strong>: Specify a plus or minus sign followed immediately by the letter E and a decimal or hexadecimal extended style number. <span class="tbd">For example, +E0x40000 would add the WS_EX_APPWINDOW style, which provides a taskbar button for a window that would otherwise lack one. Although the other extended style numbers are not yet documented here (since they are rarely used), they can be discovered on the Internet.</span>You can find a list of ExStyles with their respective numbers <a href="https://learn.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles">here</a>. <span class="x11">Currently, only one code is supported: WS_EX_NOACTIVATE (Gui, +E0x8000000). It doesn't seem to work really, try WS_POPUP instead (see "Unnamed Style" above).</span></p>
<div class="tbd">
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Flash" href="#Gui.htm__Flash" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Flash [, Off]</span> (v1.0.21+) </p>
<p class="calibre8">Blinks the window's button in the taskbar. This is done by inverting the color of the window's title bar and/or taskbar button (if it has one). The optional word OFF causes the title bar and taskbar button to return to their original colors (but the actual behavior might vary depending on OS version). In the below example, the window will blink five times because each pair of flashes inverts then restores its appearance:<br class="calibre12" /> Loop, 10<br class="calibre12" /> {<br class="calibre12" />      Gui, flash<br class="calibre12" />      Sleep, 300<br class="calibre12" /> } </p>
<p class="calibre8"> </p>
</div>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Show" href="#Gui.htm__Show" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Show [, Options, Title]</span></p>
<p class="calibre8">Makes the window visible, <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">activates</a> it, and sets its title. If <em class="calibre21">Title</em> is omitted, the previous title is retained (or if none, the script's file name is used). Leave <em class="calibre21">Options</em> blank to have the window retain its previous size and position. If there is no previous position, the window will be auto-centered in one or both dimensions if the X and/or Y options mentioned below are absent. If there is no previous size, the window will be auto-sized according to the size and positions of the controls it contains.</p>
<p class="calibre8">For <em class="calibre21">Options</em>, the following single letters are supported but rarely needed due to auto-sizing and centering mentioned above: <strong class="calibre14">W</strong> (Width), <strong class="calibre14">H</strong> (Height), <strong class="calibre14">X</strong> (X-position), and <strong class="calibre14">Y</strong> (Y-position). Include a number immediately after each option letter. The specified Width and Height are that of the client area, which will often be smaller than the width and height reported by <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a> because the client area excludes the title bar, menu bar, and window edges.</p>
<p class="calibre8">Another option is the word Center, which centers the window in both dimensions. Similarly, the string xCenter or yCenter may be specified to center the window in only one dimension. Examples:<br class="calibre12" /> Gui, Show, Center<br class="calibre12" /> Gui, Show, xCenter y0</p>
<p class="calibre8"><span class="tbd">In v1.0.24, the word AutoSize resizes the window to accommodate only its currently visible controls. This is useful to resize the window after new controls are added, or existing controls are resized, hidden, or unhidden. Example: Gui, Show, AutoSize Center </span></p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Submit" href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Submit [, NoHide]</span></p>
<p class="calibre8">Saves the contents of each control to its <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated variable</a> (if any) and hides the window unless the word NoHide is present. If the window does not exist -- perhaps due to having been destroyed via "Gui Destroy" -- this command has no effect.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Cancel" href="#Gui.htm__Cancel" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Cancel</span> (the word Hide can also be used)</p>
<p class="calibre8">Hides the window without saving the controls' contents to their associated variables. If the window does not exist -- perhaps due to having been destroyed via "Gui Destroy" -- this command has no effect.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Destroy" href="#Gui.htm__Destroy" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Destroy</span></p>
<p class="calibre8">Removes the window (if it exists) and all its controls, freeing the corresponding memory and system resources. If this command is not used, all GUI windows are automatically destroyed when the script exits.</p>
<p class="calibre8"> </p>
<div class="tbd">
<p class="calibre8"><span class="calibre17"><a id="Default" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>Default</span> [v1.0.24+]</p>
<p class="calibre8">Changes the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>'s default GUI window number, which is used whenever a window number is not specified for <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>, <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a>, and Gui. In the following example, the default window number is changed to 2: Gui, 2:Default. See <a href="#Gui.htm__Remarks" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Remarks</a> for more information about the default window.</p>
<p class="calibre8"> </p>
</div>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Add" href="#Gui.htm__Add" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Add, ControlType [, Options, Text]</span></p>
<p class="calibre8">Adds a control to a parent window (first creating the parent window itself, if necessary).</p>
<p class="calibre8"><em class="calibre21"><a id="Gui.htm__ControlType" href="#Gui.htm__ControlType" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> ControlType</em> is one of the following:</p>
<ul class="calibre10">
<li class="calibre11"><a href="#Gui.htm__Text" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Text</a>, <a href="#Gui.htm__Edit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Edit</a>, <a href="#Gui.htm__Hotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a>, <a href="#Gui.htm__Picture" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Picture</a></li>
<li class="calibre11"><a href="#Gui.htm__GroupBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupBox</a>, <a href="#Gui.htm__Button" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Button</a>, <a href="#Gui.htm__Checkbox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Checkbox</a>, <a href="#Gui.htm__Radio" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Radio</a></li>
<li class="calibre11"><a href="#Gui.htm__DropDownList" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DropDownList</a>, <a href="#Gui.htm__ComboBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ComboBox</a>, <a href="#Gui.htm__ListBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListBox</a></li>
<li class="calibre11"><a href="#Gui.htm__Slider" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Slider</a>, <a href="#Gui.htm__Progress" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>, <a href="#Gui.htm__Tab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Tab</a></li>
</ul>
<p class="calibre8"><strong class="calibre14"><span class="calibre30"><a id="Gui.htm__Text" href="#Gui.htm__Text" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Text</span></strong>: Unmodifiable text with no border; often used to label other controls. In this case, <em class="calibre21">Text</em> is the string to display. It may contain linefeeds (`n) to start new lines. If a width (W) is specified in <em class="calibre21">Options</em> but no <a href="#Gui.htm__R" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">rows (R)</a> or height (H), the text will be word-wrapped as needed, and the control's height will be set automatically.</p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__Edit" href="#Gui.htm__Edit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Edit</span></strong>: An area where free-form text can be typed. In this case, <em class="calibre21">Text</em> is the default text to display inside the edit field (linefeed [`n] may be used to start new lines in a multi-line edit control). The control will be multi-line if it has more than one row of text. For example, specifying R3 in <em class="calibre21">Options</em> will create a 3-line edit control with the following default properties: a vertical scroll bar, word-wrapping enabled, and the Enter key captured as part of the input rather than triggering the window's default button. Note: To type a literal tab inside a multi-line edit control, the user may press Control-Tab.</p>
<p class="calibre8"><span class="x11">The R option is not supported, use W/H instead. However, to make the edit be a multi-line one, specify any R > 1.</span></p>
<p class="calibre8">When a multi-line edit control is saved to its variable via <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> or <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a>, any line breaks in the text will be represented as plain linefeeds (`n) rather than the traditional CR+LF (`r`n) used by non-GUI commands such as <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a> and <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>. If the control has word-wrapping enabled, any wrapping that occurs as the user types will not result in linefeed characters (only the Enter keystroke can do that).</p>
<p class="calibre8"><span class="rm">Although multi-line edit controls are limited to 64 KB of text on Windows 95/98/Me, they may have as much as 4 GB of text on Windows NT/2k/XP or later. As the user enters text, more memory is allocated as needed. </span></p>
<p class="calibre8"><strong class="calibre14">Edit Options</strong> (to remove an option rather than adding it, precede it with a minus sign)</p>
<div class="tbd">
<p class="calibre8">Number: Prevents the user from typing anything other than digits into the field. Note: It is still possible to paste non-digits into it.</p>
<p class="calibre8">Lowercase: The characters typed by the user are automatically converted to lowercase. </p>
<p class="calibre8">Uppercase: The characters typed by the user are automatically converted to uppercase.</p>
<p class="calibre8">Limit: Restricts the user's input to the visible width of the edit field. Alternatively, to limit input to a specific number of characters, include a number immediately afterward. For example, Limit10 would allow no more than 10 characters to be entered.</p>
<p class="calibre8">Password: Hides the user's input (such as for password entry) by substituting masking characters for what the user types. If a non-default masking character is desired, include it immediately after the word Password. For example, Password* would make the masking character an asterisk rather than the black circle (bullet), which is the default on Windows XP and beyond. Note: This option has no effect for multi-line edit controls.</p>
<p class="calibre8">ReadOnly: Prevents the user from changing the control's contents. However, the text can be scrolled, selected and copied to the clipboard. </p>
<p class="calibre8">Multi: Makes it possible to have more than one line of text. However, it is usually not necessary to specify this because it will be auto-detected based on height (H), <a href="#Gui.htm__R" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">rows (R)</a>, or contents (<em class="calibre21">Text</em>).</p>
<p class="calibre8">WantReturn: Specify -WantReturn (that is, a minus sign followed by WantReturn) to prevent a multi-line edit control from capturing the Enter keystroke. Pressing Enter will then be the same as pressing the window's default button (if any). In this case, the user may press Control-Enter as a means to start a new line.</p>
<p class="calibre8">Tn [v1.0.24+]: The letter T may be used to set tab stops inside a multi-line edit control (since tab stops determine the column positions to which literal TAB characters will jump, they can be used to format the text into columns). If the letter T is not used, tab stops are set at every 32 units. If the letter T is used once, tab stops are set at every <strong class="calibre14">n</strong> units across the entire width of the control. For example, <em class="calibre21">Gui, Add, Edit, vMyEdit r16 t64</em> would double the default distance between tab stops. To have custom tab stops, specify the letter T multiple times as in the following example: <em class="calibre21">Gui, Add, Edit, vMyEdit r16 t8 t16 t32 t64 t128</em>. One tab stop is set for each of the absolute column positions in the list, up to a maximum of 50 tab stops. To type a literal tab inside a multi-line edit control, the user may press Control-Tab.</p>
<p class="calibre8"><br class="calibre12" />
<strong class="calibre14"><span class="calibre30"><a id="Hotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>Hotkey</span></strong> [v1.0.23+]: A box that looks like a single-line edit control but instead accepts a keyboard combination pressed by the user. For example, if the user presses Control+Alt+C on an English keyboard layout, the box would display "Ctrl + Alt + C".
</p>
<p class="calibre8">When the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command is used, the control's <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated output variable</a> (if any) receives the hotkey modifiers and name, which usually should be compatible with the <a href="#Hotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a> command. Examples: ^!C, +!Home, +^Down, ^Numpad1, !NumpadEnd. If there is no hotkey in the control, the output variable is made blank. Note: Some keys are displayed the same even though they are retrieved as different names. For example, both ^Numpad7 and ^NumpadHome might be displayed as Ctrl + Num 7.</p>
<p class="calibre8">By default, the control starts off with no hotkey specified. To instead have a default, specify its modifiers and name as the <em class="calibre21">Text</em> parameter. Example: "Gui, Add, Hotkey, vMyHotkey, ^!p". The only modifiers supported are ^ (Control), ! (Alt), and + (Shift). See the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list</a> for available key names.</p>
<p class="calibre8">To restrict the types of hotkeys the user may enter, include the word Limit followed by the sum of one or more of the following numbers:</p>
<p class="calibre8">1: Prevent unmodified keys<br class="calibre12" /> 2: Prevent Shift-only keys <br class="calibre12" /> 4: Prevent Control-only keys <br class="calibre12" /> 8: Prevent Alt-only keys<br class="calibre12" /> 16: Prevent Shift-Control keys <br class="calibre12" /> 32: Prevent Shift-Alt keys <br class="calibre12" /> 64: This value is not supported (it will not behave correctly).<br class="calibre12" /> 128: Prevent Shift-Control-Alt keys.</p>
<p class="calibre8">For example, Limit1 would prevent unmodified hotkeys such as letters and numbers from being entered, and Limit15 would require at least two modifier keys. If the user types a forbidden modifier combination, the Control+Alt combination is visibly and automatically substituted.</p>
<p class="calibre8">The Hotkey control has limited capabilities. For example, it does not support mouse/joystick hotkeys or the Windows key (LWin and RWin). One way to work around this is to provide one or more <a href="#Gui.htm__CheckBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">checkboxes</a> as a means for the user to enable extra modifiers such as the Windows key.</p>
</div>
<p class="calibre8"><br class="calibre12" />
<strong class="calibre14"><span class="calibre30"><a id="Gui.htm__Picture" href="#Gui.htm__Picture" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Picture</span></strong> (or <strong class="calibre14"><span class="calibre30">Pic</span></strong>): An area containing an image (see last paragraph for supported file types). The <em class="calibre21">Text</em> parameter is the filename of the image, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. <span class="x11">You can also specify a <a href="https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">standard icon name</a> by prefixing it with "icon:". Example: Gui, Add, Picture, , icon:appointment-new.</span> To retain the image's actual width and/or height, omit the W and/or H options. Otherwise, the image is scaled to the specified width and/or height. To shrink or enlarge the image while preserving its aspect ratio, specify -1 for one of the dimensions and a positive number for the other. For example, specifying "w200 h-1" would make the image 200 pixels wide and cause its height to be set automatically. If the picture cannot be loaded or displayed (e.g. file not found), the control is left empty and its height and width are set to zero.
</p>
<p class="calibre8">To use a picture as a background for other controls, the picture should normally be added prior to those controls. However, if those controls are input-capable and the picture has a <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-label</a>, create the picture after the other controls and include +0x4000000 (which is WS_CLIPSIBLINGS) in the picture's <em class="calibre21">Options</em>. This trick also allows a picture to be the background behind a Tab control.</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">Icons and cursors</strong>: In v1.0.24, icons (.ico), cursors (.cur), and animated cursors (.ani) are supported on all operating systems. In addition, icons can be loaded from EXE and DLL files that contain them. To use an icon other than the first one in the file, include in <em class="calibre21">Options</em> the word Icon followed by the number of the icon. In the following example, the second icon would be used: <em class="calibre21">Gui, Add, Picture, Icon2, C:\My Application.exe</em>. Note: Specifying an icon number causes a different icon loading method to be used, which might prevent a .ani file from being animated. It also prevents AltSubmit (see next paragraph) from taking effect.</p>
<p class="calibre8"><a id="Gui.htm__PicAltSubmit" href="#Gui.htm__PicAltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Specifying the word AltSubmit in <em class="calibre21">Options</em> tells the program to use Microsoft's GDIPlus.dll to load the image, which might result in a different appearance for certain types of images. For example, it would load an icon containing a transparent background as a transparent bitmap, which allows the <a href="#Gui.htm__BackgroundTrans" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BackgroundTrans</a> option to take effect for such an icon. If GDIPlus is not available (see next paragraph), AltSubmit is ignored and the image is loaded using the normal method.</p>
<p class="calibre8">All operating systems support GIF, JPG, and BMP images. With AutoHotkey v1.0.22+ running on Windows XP or later, additional image formats such as PNG, TIF, ICO, Exif, WMF, and EMF are supported. Operating systems older than XP can be given support by copying Microsoft's free GDI+ DLL into the AutoHotkey.exe folder (but in the case of a <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">compiled script</a>, copy the DLL into the script's folder). To download the DLL, search for the following phrase at <a href="http://www.microsoft.com" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">www.microsoft.com</a>: gdi redistributable.</p>
<p class="calibre8">Due to an OS bug, animated cursors scaled to a size greater than 90x90 on Windows 95/98/Me might crash the script.</p>
<p class="calibre8" />
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__GroupBox" href="#Gui.htm__GroupBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> GroupBox</span></strong>: A rectangular border/frame, often used around other controls to indicate they are related. In this case, <em class="calibre21">Text</em> is the title of the box, which is displayed at its upper-left edge.</p>
</div>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__Button" href="#Gui.htm__Button" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Button</span></strong>: A pushbutton, which can be pressed to trigger an action. In this case, <em class="calibre21">Text</em> is the name of the button (shown on the button itself), which may include linefeeds (`n) to start new lines. Include the word Default in <em class="calibre21">Options</em> to make it the default button. The default button's action is automatically triggered whenever the user presses ENTER, except when the keyboard focus is on a different button or a multi-line edit control having the "WantReturn" style. To later change the default button to another button, follow this example, which makes the OK button become the default: <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>, +default, OK. To later change the window to have no default button, follow this example: GuiControl, -default, OK</p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__Checkbox" href="#Gui.htm__Checkbox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Checkbox</span></strong>: A small box that can be checked or unchecked to represent On/Off, Yes/No, etc. <span class="tbd">Specify the word Check3 in <em class="calibre21">Options</em> to enable a third state that displays a gray checkmark instead of a black one (the gray state indicates that the checkbox is neither checked nor unchecked).</span> Specify the word Checked or CheckedGray in <em class="calibre21">Options</em> to have the checkbox start off with a black or gray checkmark, respectively. The <em class="calibre21">Text</em> parameter is a label displayed next to the box, typically used as a prompt or description of what the checkbox does. It may include linefeeds (`n) to start new lines. If a width (W) is specified in <em class="calibre21">Options</em> but no <a href="#Gui.htm__R" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">rows (R)</a> or height (H), <em class="calibre21">Text</em> will be word-wrapped as needed, and the control's height will be set automatically. The variable associated with a checkbox (if any) receives the number 1 for checked, 0 for unchecked, and -1 for gray/indeterminate.</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__Radio" href="#Gui.htm__Radio" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Radio</span></strong>: Radio button. A small empty circle that can be checked (on) or unchecked (off). These controls usually appear in <em class="calibre21">radio groups</em>, each of which contains two or more radio buttons. When the user clicks a radio button to turn it on, any others in its <em class="calibre21">radio group</em> are turned off automatically (the user may also navigate inside a group with the arrow keys). A <em class="calibre21">radio group</em> is created automatically around all consecutively-added radio buttons. To start a new group, specify the word Group in the <em class="calibre21">Options</em> of the first button of the new group, or simply add a non-radio control since that automatically starts a new group.</p>
<p class="calibre8">Specify the word Checked in <em class="calibre21">Options</em> to have the button start off in the "on" state. For the <em class="calibre21">Text</em> parameter, specify the label to display to the right of the radio button. This label is typically used as a prompt or description, and it may include linefeeds (`n) to start new lines. If a width (W) is specified in <em class="calibre21">Options</em> but no rows (R) or height (H), <em class="calibre21">Text</em> will be word-wrapped as needed, and the control's height will be set automatically.</p>
<p class="calibre8">The variable associated with a radio button (if any) receives the number 1 for "on" and 0 for "off". However in v1.0.20+, if only one button in a <em class="calibre21">radio group</em> has a variable, that variable will instead receive the number of the currently selected button: 1 is the first radio button (according to original creation order), 2 is the second, and so on. If there is no button selected, 0 is stored.</p>
</div>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__DropDownList" href="#Gui.htm__DropDownList" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> DropDownList</span></strong> (or <strong class="calibre14"><span class="calibre30">DDL</span></strong>): A list of choices that is displayed in response to pressing a small button. In this case, <em class="calibre21">Text</em> is is a pipe-delimited list of choices such as Choice1|Choice2|Choice3. To have one of the items pre-selected when the window first appears, include two pipe characters after it. Alternatively, include in <em class="calibre21">Options</em> the word Choose followed immediately by the number to pre-select. For example, Choose5 would pre-select the fifth item. To change the choice or add/remove entries from the list after the control has been created, use <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>.</p>
<div class="tbd">
<p class="calibre8">Specify either the word Uppercase or Lowercase in <em class="calibre21">Options</em> to automatically convert all items in the list to upper or lower case. Specify the word Sort to automatically sort the contents of the list alphabetically (this also affects any items added later via <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>).</p>
</div>
<p class="calibre8">When the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command is used, the control's <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated output variable</a> (if any) receives the text of the currently selected item. However, if the control has the <a href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a> property, the output variable will receive the item's position number instead (the first item is 1, the second is 2, etc.).</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__ComboBox" href="#Gui.htm__ComboBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> ComboBox</span></strong>: Same as DropDownList but also permits free-form text to be entered as an alternative to picking an item from the list. In addition to allowing all the same options as DropDownList above, the word Limit may be included in <em class="calibre21">Options to </em>restrict the user's input to the visible width of the ComboBox's edit field. Also, the word Simple may be specified to make the ComboBox behave as though it is an Edit field with a ListBox beneath it.</p>
<p class="calibre8">When the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command is used, the control's <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated output variable</a> (if any) receives the text of the currently selected item. However, if the control has the <a href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a> property, the output variable will receive the item's position number instead (the first item is 1, the second is 2, etc.). If either case, if there is no selected item, the output variable will be set to the contents of the ComboBox's edit field. </p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__ListBox" href="#Gui.htm__ListBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> ListBox</span></strong>: A relatively tall box containing a list of choices that can be selected. In this case, <em class="calibre21">Text</em> is is a pipe-delimited list of choices such as Choice1|Choice2|Choice3. To have list item(s) pre-selected when the window first appears, include two pipe characters after each (the multi-select option described below is required if more than one item is to be pre-selected). Alternatively, include in <em class="calibre21">Options</em> the word Choose followed immediately by a single item number to pre-select. For example, Choose5 would pre-select the fifth item. To change the choice or add/remove entries from the list after the control has been created, use <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>.</p>
<p class="calibre8">Specify the word ReadOnly in <em class="calibre21">Options</em> to prevent items from being visibly highlighted when they are selected (but <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> will still store the selected item). Specify the word Sort to automatically sort the contents of the list alphabetically (this also affects any items added later via <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>).</p>
<p class="calibre8">When the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command is used, the control's <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated output variable</a> (if any) receives the text of the currently selected item. However, if the control has the <a href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a> property, the output variable instead receives the item's position number (the first item is 1, the second is 2, etc.).</p>
<p class="calibre8">Multi-select ListBox: Specify the word Multi in <em class="calibre21">Options</em> to allow more than one item to be selected simultaneously via shift-click and control-click (to avoid the need for shift/control-click, specify <a href="#Styles.htm__LBS_MULTI" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">the number 8</a> instead of the word Multi). In this case, <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> stores a pipe delimited list of item-strings in the control's <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">output variable</a>. However, if the <a href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a> option is in effect, <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> stores a pipe-delimited list of item numbers instead. For example, 1|2|3 would indicate that the first three items are selected. To extract the individual items from the string, use a <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> such as this example:<br class="calibre12" /> Loop, parse, MyListBox, |<br class="calibre12" /> {<br class="calibre12" />      MsgBox Selection number %A_Index% is %A_LoopField%.<br class="calibre12" /> }</p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__Slider" href="#Gui.htm__Slider" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Slider</span></strong> [v1.0.23+]: A sliding bar that the user can move along a vertical or horizontal track. The standard volume control in the taskbar's tray is an example of a slider.</p>
<p class="calibre8"> The user may slide the control by the following means: 1) dragging the bar with the mouse; 2) clicking away from the bar with the mouse; 3) turning the mouse wheel while the control has focus; or 3) pressing the following keys while the control has focus: Arrow keys, Page-up, Page-down, Home, and End.</p>
<p class="calibre8">Specify the starting position number of the slider as the <em class="calibre21">Text</em> parameter. If <em class="calibre21">Text</em> is omitted, the slider starts off at 0 or the number in the allowable range that is closest to 0.</p>
<p class="calibre8">When the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command is used, the control's <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated output variable</a> (if any) receives the current numeric position of the slider. The position is also stored in the output variable whenever the control's <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-label</a> is launched.</p>
<p class="calibre8">If there is a <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-label</a>, by default it will be launched only when the user has stopped moving the slider (such as by releasing the mouse button after having dragging it). However, if a slider has the word AltSubmit in its <em class="calibre21">Options</em>, the g-label is launched for all slider events and the built-in variable A_GuiControlEvent will contain one of the following digits or strings:</p>
<p class="calibre8">0: The user pressed the Left-arrow or Up-arrow key.<br class="calibre12" /> 1: The user pressed the Right-arrow or Down-arrow key.<br class="calibre12" /> 2: The user pressed the Page-up key.<br class="calibre12" /> 3: The user pressed the Page-down key.<br class="calibre12" /> 4: The user moved the slider via the mouse wheel, or finished a drag-and-drop to a new position.<br class="calibre12" /> 5: The user is currently dragging the slider via the mouse; that is, the mouse button is currently down.<br class="calibre12" /> 6: The user pressed the Home key to send the slider to the left or top side. <br class="calibre12" /> 7: The user pressed the End key to send the slider to the right or bottom side. <br class="calibre12" /> Normal: The user has finished moving the slider, either via the mouse or the keyboard. <u class="calibre20">Note</u>: With the exception of mouse wheel movement (#4), the g-label is launched again for the "normal" event even though it was already launched for one of the digit-events above.</p>
<p class="calibre8"><strong class="calibre14">Slider Options</strong></p>
<p class="calibre8">Vertical: Makes the control slide up and down rather than left and right.</p>
<p class="calibre8">Invert [v1.0.24+]: Reverses the control so that the lower value is considered to be on the right/bottom rather than the left/top. This is typically used to make a vertical slider move in the direction of a traditional volume control. Note: The ToolTip option described below will not obey the inversion and therefore should not be used in this case.</p>
<p class="calibre8">Range: Sets the range to be something other than 0 to 100. After the word Range, specify the minimum, a dash, and maximum. For example, Range1-1000 would allow a number between 1 and 1000 to be selected; Range-50-50 would allow a number between -50 and 50; and Range-10--5 would allow a number between -10 and -5.</p>
<p class="calibre8">Center: The thumb (the bar moved by the user) will be blunt on both ends rather than pointed at one end. </p>
<p class="calibre8">Left: The thumb (the bar moved by the user) will point to the top rather than the bottom. But if the Vertical option is in effect, the thumb will point to the left rather than the right.</p>
<p class="calibre8">NoTicks: No tickmarks will be displayed.</p>
<p class="calibre8">TickInterval: Provides tickmarks at the specified interval. After the word TickInterval, specify the interval at which to display additional tickmarks (if the interval is omitted, it is assumed to be one). For example, TickInterval10 would display a tickmark once every 10 positions.</p>
<p class="calibre8">ToolTip: Creates a tooltip that reports the numeric position of the slider as the user is dragging it. To have the tooltip appear in a non-default position, specify one of the following instead: ToolTipLeft or ToolTipRight (for horizontal sliders); ToolTipTop or ToolTipBottom (for vertical sliders). Windows 95 and NT4 require Internet Explorer 3.0 or later to support this option</p>
<p class="calibre8">Line: Specifies the number of positions to move when the user presses one of the arrow keys. After the word Line, specify number of positions to move. Example: Line2</p>
<p class="calibre8">Page: Specifies the number of positions to move when the user presses the Page-up or Page-down key. After the word Page, specify number of positions to move. Example: Page10</p>
<p class="calibre8">Thick: Specifies the length of the thumb (the bar moved by the user). After the word Thick, specify the thickness in pixels (e.g. Thick30). To go beyond a certain thickness on Windows XP or later, it is probably necessary to either specify the Center option or remove the theme from the control (which can be done by specifying "Gui -theme" prior to creating it and "Gui +theme" afterward).</p>
<p class="calibre8">Buddy1 and Buddy2: Specifies up to two existing controls to automatically reposition at the ends of the slider. Buddy1 is displayed at the left or top side (depending on whether the Vertical option is present). Buddy2 is displayed at the right or bottom side. After the word Buddy1 or Buddy2, specify the <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable name</a> of an existing control. For example, Buddy1MyTopText would assign the control whose variable name is MyTopText. Windows 95 and NT4 require Internet Explorer 3.0 or later to support this option.</p>
<p class="calibre8">The above options can be changed after the control is created via <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>. </p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" />
<span class="calibre30"><a id="Gui.htm__Progress" href="#Gui.htm__Progress" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Progress</span></strong> [v1.0.23+]: A dual-color bar typically used to indicate how much progress has been made toward the completion of an operation.</p>
<p class="calibre8"> Specify the starting position number of the bar as the <em class="calibre21">Text</em> parameter. If <em class="calibre21">Text</em> is omitted, the bar starts off at 0 or the number in the allowable range that is closest to 0. To later change the position of the bar, follow these examples, all of which operate upon a progress bar whose <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated variable name </a> is MyProgress:<br class="calibre12" />
<a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>,, MyProgress, +20 ; Increase the current position by 20.<br class="calibre12" />
<a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>,, MyProgress, 50 ; Set the current position to 50.
</p>
<p class="calibre8">For horizontal Progress Bars, the thickness of the bar is equal to the the control's height. For vertical Progress Bars it is equal to the control's width.</p>
<p class="calibre8"><strong class="calibre14">Progress Options</strong></p>
<p class="calibre8">Vertical: Makes the bar rise or fall vertically rather than move along horizontally. Windows 95 and NT4 require Internet Explorer 3.0 or later to support this option.</p>
<p class="calibre8">Cn: Changes the bar's color. Specify for <strong class="calibre14">n</strong> one of the 16 primary HTML <a href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">color names</a> or a 6-digit RGB color value. Examples: cRed, cFFFF33, cDefault. If the C option is never used (or cDefault is specified), the system's default bar color will be used.</p>
<p class="calibre8">BackgroundN: Changes the bar's background color. Specify for <strong class="calibre14">n</strong> one of the 16 primary HTML <a href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">color names</a> or a 6-digit RGB color value. Examples: BackgroundGreen, BackgroundFFFF33, BackgroundDefault. If the Background option is never used (or BackgroundDefault is specified), the background color will be that of the window or tab control behind it.</p>
<p class="calibre8">Range: Sets the range to be something other than 0 to 100. After the word Range, specify the minimum, a dash, and maximum. For example, Range1-1000 would allow a numbers between 1 and 1000; Range-50-50 would allow numbers between -50 and 50; and Range-10--5 would allow numbers between -10 and -5. On Windows 95 and NT4, negative ranges and ranges beyond 65535 will not behave correctly unless Internet Explorer 3.0 or later is installed.</p>
<p class="calibre8">-Smooth (minus Smooth): Displays a length of segments rather than a smooth continuous bar. Specifying -Smooth is also one of the requirements to show a themed progress bar on Windows XP or later. The other requirement is that the bar not have any custom colors; that is, that the C and Background options be omitted. Windows 95 and NT4 require Internet Explorer 3.0 or later to support this option.</p>
<p class="calibre8">The above options can be changed after the control is created via <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>. </p>
<p class="calibre8"><br class="calibre12" />
<strong class="calibre14"><span class="calibre30"><a id="Gui.htm__Tab" href="#Gui.htm__Tab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Tab</span></strong> [v1.0.22+]: A relatively large control containing multiple pages, each of which contains other controls. From this point forward, these pages are referred to as "tabs".
</p>
<p class="calibre8">The <em class="calibre21">Text</em> parameter is is a pipe-delimited list of tabs such as General|View|Appearance|Settings. To have one of the tabs pre-selected when the window first appears, include two pipe characters after it. Alternatively, include in <em class="calibre21">Options</em> the word Choose followed immediately by the number to pre-select. For example, Choose5 would pre-select the fifth tab. To change the selected tab, add tabs, or remove tabs after the control has been created, use <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>.</p>
<p class="calibre8">After creating a Tab control, subsequently-added controls automatically belong to its first tab. This can be changed at any time by following these examples:</p>
<p class="calibre8">Gui, Tab -- Future controls are not part of any tab control.<br class="calibre12" /> Gui, Tab, Name -- Future controls are owned by the tab whose name starts with <em class="calibre21">Name</em> (not case sensitive). <br class="calibre12" /> Gui, Tab, 3 -- Future controls are owned by the third tab of the current tab control.<br class="calibre12" /> Gui, Tab, 3, 2 -- Future controls are owned by the third tab of the second tab control.</p>
<p class="calibre8">It is possible to use the "Gui Tab" command above to assign controls to a tab or tab-control that doesn't yet exist (except in the case of the <em class="calibre21">Name</em> method). But in that case, the relative positioning options described below are not supported.</p>
<p class="calibre8">Positioning: When each tab of a Tab control receives its first sub-control, that sub-control will have a special default position under the following conditions: 1) The X and Y coordinates are both omitted, in which case the sub-control is positioned at the upper-left corner of the tab control's interior (with a standard margin); 2) The <a href="#Gui.htm__PosPlus" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">X+n and/or Y+n </a>positioning options are specified, in which case the sub-control is positioned relative to the upper-left corner of the tab control's interior. For example, specifying "x+10 y+10" would position the control 10 pixels right and 10 pixels down from the upper left corner.</p>
<p class="calibre8">Sub-controls do not necessarily need to exist within their Tab control's boundaries: they will still be hidden and shown whenever their tab is selected or de-selected. This behavior is especially useful with the "buttons" style described below.</p>
<p class="calibre8">When the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command is used, the control's <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">associated output variable</a> (if any) receives the name of the currently selected tab. However, if the control has the <a href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a> property, the output variable will receive the tab's position number instead (the first tab is 1, the second is 2, etc.).</p>
<p class="calibre8">If a tab control has both a <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-label</a> and an <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">output variable</a>, the output variable will be set to the previously selected tab name (or number in the case of <a href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a>) whenever the user switches to a new tab. </p>
<p class="calibre8">Styles and Options: Specify -background (minus followed by the word background) to override the window's <a href="#Gui.htm__Color" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom background color</a> and use the system's default Tab control color. Specify -wrap to prevent the tabs from taking up more than a single row (in which case if there are too many tabs to fit, arrow buttons are displayed to allow the user to slide more tabs into view). Specify the word Buttons to have a series of buttons at the top of the control rather than a series of tabs (in this case, there will be no border by default because the display area does not typically contain controls). To have the tabs on the left, right, or bottom side instead of the top, specify in <em class="calibre21">Options</em> the word Left, Right, or Bottom, respectively (but see <a href="#Styles.htm__tcs_vertical" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">TCS_VERTICAL</a> for limitations on Left and Right).</p>
<p class="calibre8">Keyboard navigation: The user may press Control-PageDown/PageUp to navigate from page to page in a tab control; if the keyboard focus is on a control that does not belong to a Tab control, the window's first Tab control will be navigated. Control-Tab and Control-Shift-Tab may also be used except that they will not work if the currently focused control is a multi-line Edit control.</p>
<p class="calibre8">Each window may have no more than 255 tab controls. Each tab control may have no more than 256 tabs (pages).</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Position" href="#Gui.htm__Position" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Positioning and Layout via SmartGUI Creator </span></p>
<p class="calibre8">Although the options described in the next section are suitable for simple layouts, you may find it easier to use Rajat's SmartGUI Creator because it's entirely visual, i.e. "what you see is what you get". SmartGUI Creator is free and can be downloaded from <a href="http://www.autohotkey.com/docs/SmartGUI/" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">http://www.autohotkey.com/docs/SmartGUI/</a></p>
<p class="calibre8"> </p>
</div>
<p class="calibre8"><span class="calibre17">Options for Size and Position</span></p>
<p class="calibre8">If some dimensions and/or coordinates are omitted from <em class="calibre21">Options</em>, the control will be positioned relative to the previous control and/or sized automatically according to its nature and contents.</p>
<p class="calibre8">The following options are supported:</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__R" href="#Gui.htm__R" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> R</strong>: Rows of text (can contain a floating point number such as R2.5). <strong class="calibre14">R</strong> is often preferable to specifying <strong class="calibre14">H</strong> (Height). If both the <strong class="calibre14">R</strong> and <strong class="calibre14">H</strong> options are present, <strong class="calibre14">R</strong> will take precedence. For a GroupBox, this setting is the number of controls for which to reserve space inside the box. For DropDownLists, ComboBoxes, and ListBoxes, it is the number of items visible at one time inside the list portion of the control (but on Windows XP, it is often desirable to omit both the <strong class="calibre14">R</strong> and <strong class="calibre14">H</strong> options for DropDownList and ComboBox, which makes the popup list automatically take advantage of the available height of the user's desktop). For other control types, <strong class="calibre14">R</strong> is the number of rows of text that can fit inside the control.</p>
</div>
<p class="calibre8"><strong class="calibre14">W</strong>: Width, in pixels. If omitted, the width is calculated automatically for some control types based on their contents. The other controls types have the following default widths:<br class="calibre12" /> Tab controls: 30 times the current font size, plus 3 times the X margin.<br class="calibre12" /> Vertical Progress Bars: Two times the current font size.<br class="calibre12" /> Horizontal Progress Bars, horizontal Sliders, DropDownLists, ComboBoxes, ListBoxes, GroupBoxes, Edits, and Hotkeys: 15 times the current font size (except GroupBoxes, which multiply by 18 to provide room inside for margins).</p>
<p class="calibre8"> <strong class="calibre14">H</strong>: Height, in pixels. If both the <strong class="calibre14">H</strong> and <strong class="calibre14">R</strong> options are absent, DropDownLists, ComboBoxes, ListBoxes, and empty multi-line Edit controls default to 3 rows; GroupBoxes default to 2 rows; vertical Sliders and Progress Bars default to 5 rows; horizontal Sliders default to 30 pixels (except if a thickness has been specified); horizontal Progress Bars default to 2 times the current font size; Hotkey controls default to 1 row; and Tab controls default to 10 rows. For the other control types, the height is calculated automatically based on their contents. Note that for DropDownLists and ComboBoxes, <strong class="calibre14">H</strong> is the combined height of the control's always-visible portion and its list portion (but even if the height is set too low, at least one item will always be visible in the list). Also, for all types of controls, specifying the number of rows via the <strong class="calibre14">R</strong> option is usually preferable to using <strong class="calibre14">H</strong> because it prevents a control from showing partial/incomplete rows of text.</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">wp+n</strong>, <strong class="calibre14">hp+n</strong>, <strong class="calibre14">wp-n</strong>, <strong class="calibre14">hp-n</strong> (where <strong class="calibre14">n</strong> is any number) can be used to set the width and/or height of a control equal to the previously added control's width or height, with an optional plus or minus adjustment. For example, wp would set a control's width to that of the previous control, and wp-50 would set it equal to 50 less than that of the previous control. [requires 1.0.23+] </p>
</div>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__XY" href="#Gui.htm__XY" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> X</strong>: X-position. For example, specifying "x0 y0" would position the control in the upper left corner of the window's client area, which is the area beneath the title bar and menu bar (if any). If <strong class="calibre14">X</strong> is omitted but not <strong class="calibre14">Y</strong>, the control will be positioned to the right of all previously added controls, which can be thought of as starting a new "column".</p>
<p class="calibre8"><strong class="calibre14">Y</strong>: Y-position. If <strong class="calibre14">Y</strong> is omitted but not <strong class="calibre14">X</strong>, the control will be positioned beneath all previously added controls, which can be thought of as starting a new "row". </p>
<p class="calibre8">Omitting either <strong class="calibre14">X, </strong><strong class="calibre14">Y</strong> or both is useful to make a GUI layout automatically adjust to any future changes you might make to the size of controls or font point size. By contrast, specifying an absolute position for every control might require you to manually shift the position of all controls that lie beneath and/or to the right of a control that is being enlarged or reduced.</p>
<p class="calibre8">If both <strong class="calibre14">X</strong> and <strong class="calibre14">Y</strong> are omitted, the control will be positioned beneath the previous control using a standard padding distance.</p>
<div class="tbd">
<p class="calibre8"><a id="Gui.htm__PosPlus" href="#Gui.htm__PosPlus" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> For <strong class="calibre14">X</strong> and <strong class="calibre14">Y</strong>, an optional plus sign can be included to position a control relative to the bottom or right edge (respectively) of the control that was previously added. For example, specifying Y+10 would position the control 10 pixels beneath the bottom of the previous control rather than using the standard padding distance. Similarly, specifying X+10 would position the control 10 pixels to the right of the previous control's right edge. Note: minus signs cannot be used because they are reserved for absolute positioning.</p>
</div>
<p class="calibre8"><strong class="calibre14">xp+n</strong>, <strong class="calibre14">yp+n</strong>, <strong class="calibre14">xp-n</strong>, <strong class="calibre14">yp-n</strong> (where <strong class="calibre14">n</strong> is any number) can be used to position controls relative to the previous control's upper left corner, which is often useful for enclosing controls in a GroupBox.</p>
<p class="calibre8"><strong class="calibre14">xm</strong> and <strong class="calibre14">ym</strong> can be used to position a control at the leftmost and topmost margins of the window, respectively (these two may also be followed by a plus/minus sign and a number). A window's margin size is proportional to the font size that was in effect when its first control was added. By specifying <strong class="calibre14">ym</strong> without any x-position at all, the control will be positioned at the top margin but to the right of all previously added controls, which can be thought of as starting a new "column". The converse is also true.</p>
<p class="calibre8"><a id="Gui.htm__xs" href="#Gui.htm__xs" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> In v1.0.20+, <strong class="calibre14">xs</strong> and <strong class="calibre14">ys</strong> are similar to <strong class="calibre14">xm</strong> and <strong class="calibre14">ym </strong>except that they refer to coordinates that were saved by having previously added a control with the word <a href="#Gui.htm__Section" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Section</a> in its options (the first control of the window always starts a new section, even if that word isn't specified in its options). By specifying <strong class="calibre14">ys</strong> without any x-position at all, the control will be positioned at the previously saved y-position, but to the right of all controls that have been added since the most recent use of the word <a href="#Gui.htm__Section" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Section</a>; this can be thought of as starting a new column within the section. Example:<br class="calibre12" /> gui, add, edit, w600 ; Add a fairly wide edit control at the top of the window.<br class="calibre12" /> gui, add, text, <strong class="calibre14">section</strong>, First Name: ; Save this control's position and start a new section.<br class="calibre12" /> gui, add, text,, Last Name:<br class="calibre12" /> gui, add, edit, <strong class="calibre14">ys</strong> ; Start a new column within this section.<br class="calibre12" /> gui, add, edit<br class="calibre12" /> gui, show</p>
<p class="calibre8">The converse of the above (specifying <strong class="calibre14">xs</strong> but omitting the y-position) is also true.</p>
<p class="calibre8"><strong class="calibre14">xs</strong> and <strong class="calibre14">ys</strong> may optionally be followed by a plus/minus sign and a number. Also, it is possible to specify both the word <a href="#Gui.htm__Section" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Section</a> and xs/ys in a control's options, which uses the previous section for itself but establishes a new section for subsequent controls.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Events" href="#Gui.htm__Events" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Options for Assigning Actions and Variables to Controls </span></p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__var" href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> V</strong>: Variable. To associate a variable with a control, include the letter V followed immediately by the name of the variable. Example: vMyEdit. This variable will be given the contents of its control whenever the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command is used. If a control is not input-capable -- such as a Text control or GroupBox -- assigning a variable to it can still be helpful since that variable's name serves as the control's unique identifier for use with <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a> and <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a>. Note: <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> does not change the contents of variables associated with control types such as Text and GroupBox. </p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__label" href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> G</strong>: Gosub. To launch a subroutine in response to the press of a button, changing of a checkbox/radio, selection of a new choice in a ListBox/ComboBox/DropDownList/Tab control, or the clicking of a Picture or Text control: include the letter G followed immediately by the name of the label to execute. The special label gCancel will perform an implicit "Gui Cancel", but only if no "Cancel" label exists in the script.</p>
<p class="calibre8">The <strong class="calibre14">G</strong> option may be omitted for a button, in which case an automatic label is assumed. For example, if the script contains an OK button and a ButtonOK label, that label will be launched when the button is pressed. However, if the text on the button contains spaces, ampersands, linefeeds (`n) or carriage returns (`r), its automatic label will omit those characters. For example, a button titled "&amp;OK" (that is, containing the letter O underlined as a shortcut key) would have an automatic label of ButtonOK. Similarly, a button titled "Save &amp;&amp; Exit" would have an automatic label of ButtonSaveExit. For GUI windows other than the first (see remarks section), the window number is included in front of the button's automatic label, e.g. 2ButtonOK.</p>
<p class="calibre8">You can detect a double-click by checking the contents of the built-in variable <a href="#Variables.htm__GuiControlEvent" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_GuiControlEvent</a>. The following control types support this: Text, Picture, Radio, and ListBox. [requires v1.0.20+] </p>
<p class="calibre8">A label specified by the <strong class="calibre14">G</strong> option cannot contain spaces because spaces are used to separate items in the options list. To work around this, include an additional label above the desired target label as in this example:</p>
<p class="calibre8">MyLabel:<br class="calibre12" /> ::my hotstring::<br class="calibre12" /> MsgBox Both the above labels will execute this subroutine.<br class="calibre12" /> return</p>
<p class="calibre8"> </p>
<div class="tbd">
<p class="calibre8"><span class="calibre17"><a id="OtherOptions" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"></a>Common Styles and Other Options</span> [some require v1.0.21+]</p>
<p class="calibre8">Note: In the absence of a preceding sign, a plus sign is assumed; for example, Wrap is the same as +Wrap. By contrast, -Wrap would remove the word-wrapping property.</p>
<p class="calibre8"><strong class="calibre14">C</strong>: Color of text. Specify the letter C followed immediately by a color name (see <a href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">color chart</a>) or RGB value (the 0x prefix is optional). Examples: cRed, cFFFFAA, c0xFFFFAA, cDefault</p>
<p class="calibre8"><strong class="calibre14">Disabled</strong>: Makes an input-capable control appear in a disabled state (it cannot be activated or modified by the user). Use "<a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a> Enable" to enable it later. Note: To make an Edit control read-only, specify the string ReadOnly instead.</p>
<p class="calibre8"><strong class="calibre14">Hidden</strong>: The control is initially invisible. Use "<a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a> Show" to show it later.</p>
<p class="calibre8"><strong class="calibre14">Left</strong>: Left-justifies the control's text within its available width (meaningful only for buttons).</p>
<p class="calibre8"><strong class="calibre14">Right</strong>: Right-justifies the control's text within its available width. For checkboxes and radio buttons, this also puts the box itself on the right side of the control rather than the left. </p>
<p class="calibre8"><strong class="calibre14">Center</strong>: Centers the control's text within its available width. </p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__TabStop" href="#Gui.htm__TabStop" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> TabStop</strong>: Use -Tabstop (i.e. minus TabStop) to have an input-capable control skipped over when the user presses the TAB key to navigate.</p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__Section" href="#Gui.htm__Section" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Section</strong>: Starts a new section and saves this control's position for later use with the xs and ys positioning options described <a href="#Gui.htm__xs" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">above</a>.</p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__AltSubmit" href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> AltSubmit</strong>: Uses alternate submit method. For DropDownList, ComboBox, and ListBox this causes the <a href="#Gui.htm__Submit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command to store the position of the selected item rather than its text. If no item is selected, a ComboBox will still store the text in its edit field; similarly, a DropDownList or ListBox will still make its <a href="#Gui.htm__var" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">output variable</a> blank. Note: AltSubmit also affects the behavior of <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a> when it is used against a control that has this property.</p>
<p class="calibre8"><strong class="calibre14">Wrap</strong>: Enables word-wrapping of the control's contents within its available width. Since nearly all control types start off with word-wrapping enabled, precede Wrap with a minus sign to disable word-wrapping.</p>
<p class="calibre8"><strong class="calibre14">VScroll</strong>: Provides a vertical scroll bar if appropriate for this type of control. </p>
<p class="calibre8"><strong class="calibre14">HScroll</strong>: Provides a horizontal scroll bar if appropriate for this type of control. The rest of this paragraph applies to ListBox only. The horizontal scrolling width defaults to 3 times the width of the ListBox. To specify a different scrolling width, include a number immediately after the word HScroll. For example, HScroll500 would allow 500 pixels of scrolling inside the ListBox. However, if the specified scrolling width is smaller than the width of the ListBox, no scroll bar will be shown. The advantage of this is that it makes it possible for the horizontal scroll bar to be added later via "<a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>, +HScroll500, MyScrollBar", which is otherwise impossible.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17">Uncommon Styles and Options</span> [requires v1.0.21+]</p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__BackgroundTrans" href="#Gui.htm__BackgroundTrans" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> BackgroundTrans</strong> [v1.0.23+]: Uses a transparent background, which allows any control that lies behind a Text, Picture, or GroupBox control to show through. For example, a transparent Text control displayed on top of a Picture control would make the text appear to be part of the picture. Use "<a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a> +background" to remove this option later. See <a href="#Gui.htm__PicAltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Picture control's AltSubmit section</a> for more information about transparent images. </p>
<p class="calibre8"><strong class="calibre14">-Background</strong> (i.e. minus Background): Uses the standard background color rather than the one set by the "Gui Color" command. This is most often used to make a Tab control have its standard color rather than the window color. Use "<a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a> +background" to remove this option later.</p>
<p class="calibre8"><strong class="calibre14">Border</strong>: Provides a thin-line border around the control. Most controls do not need this because they already have a type-specific border.</p>
<p class="calibre8"><strong class="calibre14">(Unnamed Style)</strong>: Specify a plus or minus sign followed immediately by a decimal or hexadecimal <a href="#Styles.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">style number</a>. If the sign is omitted, a plus sign is assumed.</p>
<p class="calibre8"><strong class="calibre14">(Unnamed ExStyle)</strong>: Specify a plus or minus sign followed immediately by the letter E and a decimal or hexadecimal extended style number. If the sign is omitted, a plus sign is assumed. For example, E0x200 would add the WS_EX_CLIENTEDGE style, which provides a border with a sunken edge that might be appropriate for pictures and other controls. Although the other extended style numbers are not yet documented here (since they are rarely used), they can be discovered on the Internet.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17">Context Sensitive Options</span></p>
<p class="calibre8">See the description of each control type <a href="#Gui.htm__ControlType" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">above</a> for a list of options that apply only to it.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><a id="Gui.htm__Remarks" href="#Gui.htm__Remarks" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Remarks</span></p>
</div>
<p class="calibre8">The following labels will be automatically associated with a GUI window if they exist in the script:</p>
<p class="calibre8 tbd"><strong class="calibre14">GuiEscape</strong>: Launched when the user presses Escape. If this label is absent, pressing Escape has no effect. </p>
<p class="calibre8"><strong class="calibre14">GuiClose</strong>: Launched when the window is closed by any of the following: pressing its X button in the title bar, selecting "Close" from its system menu, or closing it with <a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a>. If this label is absent, closing the window simply hides it, which is the same effect as "Gui Cancel".</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__GuiSize" href="#Gui.htm__GuiSize" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> GuiSize</strong> [v1.0.24+]: Launched when the window is resized, minimized, maximized, or restored. The variables A_GuiWidth and A_GuiHeight contain the new width and height of the window's client area, which is the area excluding title bar, menu bar, and borders. In addition, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will contain one of the following digits:<br class="calibre12" /> 0: The window has been restored, or resized normally such as by dragging its edges.<br class="calibre12" /> 1: The window has been minimized.<br class="calibre12" /> 2: The window has been maximized.</p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__GuiDropFiles" href="#Gui.htm__GuiDropFiles" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> GuiDropFiles</strong> [v1.0.24+]: Launched whenever files/folders are dropped onto the window as part of a drag-and-drop operation (but if the label is already running, drop events are ignored). The subroutine may check the <a href="#Variables.htm__GuiControl" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_GuiControl</a> variable to find out which control the files were dropped onto (blank if none). It may also check A_GuiControlEvent to find out the names of the files that were dropped (each filename except the last is terminated by a linefeed [`n]). To extract the individual files, use a <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> as shown below:</p>
<pre class="calibre22">Loop, parse, A_GuiControlEvent, `n
{
MsgBox, 4,, File number %A_Index% is:`n%A_LoopField%.`n`nContinue?
IfMsgBox, No, Break
}
; To extract only the first file, follow this example:
Loop, parse, A_GuiControlEvent, `n
{
FirstFile = %A_LoopField%
Break
}
; To process the files in alphabetical order, follow this example:
FileList = %A_GuiControlEvent%
Sort, FileList
Loop, parse, FileList, `n
{
MsgBox, 4,, File number %A_Index% is:`n%A_LoopField%.`n`nContinue?
IfMsgBox, No, Break
}</pre>
<p class="calibre8">To temporarily disable drag-and-drop for a window, remove the WS_EX_ACCEPTFILES style via "Gui -E0x10". To re-enable it later, use "Gui +E0x10". </p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" /> General remarks about GUI events</strong></p>
</div>
<p class="calibre8">To have multiple events perform the same subroutine, specify their labels consecutively above the subroutine. For example:<br class="calibre12" /> GuiEscape:<br class="calibre12" /> GuiClose:<br class="calibre12" /> ButtonCancel:<br class="calibre12" /> Gui, Cancel ; All of the above labels will execute this subroutine. <br class="calibre12" /> return</p>
<p class="calibre8">For windows other than the first (see below), the window's number is used as a prefix, e.g. 2GuiEscape and 2GuiClose. </p>
<div class="tbd">
<p class="calibre8">A script may have up to 10 GUI windows simultaneously. To operate upon a window number other than the default (see below), include a number followed by a colon in front of the sub-command as in these examples:<br class="calibre12" /> Gui, 2:Add, Text,, Text for about box. <br class="calibre12" /> Gui, 2:Show</p>
<p class="calibre8">A GUI <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> is defined as any thread launched as a result of a GUI action. GUI actions include selecting an item from a GUI window's menu bar, or triggering one of its <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-labels</a> (such as by pressing a button).</p>
<p class="calibre8">The default window number for a GUI thread is that of the window that launched the thread. Non-GUI threads use 1 as their default.</p>
<p class="calibre8">Similarly, whenever a GUI <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> is launched, that thread's <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">last found window</a> starts off as the GUI window itself. This allows commands for windows and controls -- such as <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove, </a><a href="#WinHide.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinHide</a>, <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a>, <a href="#WinSetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSetTitle</a>, and <a href="#ControlGetFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetFocus</a> -- to omit WinTitle and WinText when operating upon the GUI window itself.</p>
<p class="calibre8">Clicking on a control while its subroutine is already running from a prior click will have no effect.</p>
<p class="calibre8">The built-in variables <a href="#Variables.htm__Gui" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Gui</a> and <a href="#Variables.htm__GuiControl" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_GuiControl</a> contain the window number and Control ID that launched the current thread. See their links for details. </p>
<p class="calibre8">All GUI <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> start off fresh with the default values for settings such as <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>. These defaults can be changed in the <a href="#Scripts.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">auto-execute section</a>.</p>
<p class="calibre8">A GUI window may be navigated via the TAB key, which moves keyboard focus to the next input-capable control (controls lacking the TabStop style are skipped). The order of navigation is determined by the order in which the controls were originally added. When the window is shown for the first time, the first input-capable control that has the TabStop style will have keyboard focus.</p>
<p class="calibre8">Certain controls may contain an ampersand (&amp;) to create a keyboard shortcut, which is displayed in the control's text as an underlined character. A user activates the shortcut by holding down the ALT key then typing the corresponding character. For buttons, checkboxes, and radio buttons, pressing the shortcut is the same as clicking the control. For GroupBoxes and Text controls, pressing the shortcut causes keyboard focus to jump to the first input-capable <a href="#Gui.htm__TabStop" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">tabstop</a> control that was created after it. However, if more than one control has the same shortcut key, pressing the shortcut will alternate keyboard focus among all controls with the same shortcut. </p>
<p class="calibre8">To display a literal ampersand inside the control types mentioned above, specify two consecutive ampersands as in this example: Save &amp;&amp; Exit</p>
<p class="calibre8">When the first control is added to a window, the window acquires a default margin on all sides proportional to the size of the currently selected font (0.75 times font-height for top &amp; bottom, and 1.25 times font-height for left &amp; right). This margin is respected during the auto-positioning of any control that lacks an explicit <a href="#Gui.htm__XY" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">X or Y coordinate</a>. The margin is also used by the first use of the "Gui Show" command to calculate the window's size (if no explicit size was given).</p>
<p class="calibre8">For its icon, a GUI window uses the tray icon that was in effect at the time the window was created. Thus, to have a different icon, change the tray icon before creating the window. Example: <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, Tray, Icon, MyIcon.ico</p>
<p class="calibre8">Checkboxes, Radio buttons, and GroupBoxes for which a non-default text color was specified will take on Classic Theme appearance on Windows XP and beyond. If this is undesirable, avoid using a non-default text color for these control types.</p>
<p class="calibre8">Use <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a> and <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a> to operate upon individual controls in a GUI window. </p>
<p class="calibre8">Any script that uses the GUI command anywhere is automatically <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a>. In v1.0.20+, it is also single-instance unless the <a href="#h_SingleInstance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#SingleInstance</a> directive has been used to override that.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>, <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashImage</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14"><a id="Gui.htm__Examples" href="#Gui.htm__Examples" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Examples</strong></p>
<pre class="calibre22">; Example #1: Simple input-box:
Gui, add, text,, First name:
Gui, add, text,, Last name:
Gui, add, edit, vFirstName ym ; The ym option starts a new column of controls.
Gui, add, edit, vLastName
Gui, add, button, default, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, show,, Simple Input Example
return ; End of auto-execute section. The script is idle until the user does something.
GuiClose:
ButtonOK:
Gui, submit ; Save the input from the user to each control's associated variable.
MsgBox You entered "%FirstName% %LastName%".
ExitApp
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #2: Tab control:
Gui, add, tab,, First Tab|Second Tab|Third Tab
Gui, add, checkbox, vMyCheckbox, Sample checkbox
Gui, tab, 2
Gui, add, radio, vMyRadio, Sample radio1
Gui, add, radio,, Sample radio2
Gui, tab, 3
Gui, add, edit, vMyEdit r5 ; r5 means 5 rows tall.
Gui, tab ; i.e. subsequently-added controls will not belong to the tab control.
Gui, add, button, default xm, OK ; xm puts it at the bottom left corner.
Gui, show
return
ButtonOK:
GuiClose:
GuiEscape:
Gui, submit
MsgBox You entered:`n%MyCheckbox%`n%MyRadio%`n%MyEdit%
ExitApp
</pre><hr class="calibre24"/><pre class="calibre22">
Example #3: ListBox containing files in a directory:
Gui, Add, Text,, Pick a file to launch from the list below.`nTo cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vMyListBox gMyListBox w640 r10
Gui, Add, Button, Default, OK
Loop, C:\*.* ; Change this folder and wildcard pattern to suit your preferences.
{
GuiControl,, MyListBox, %A_LoopFileFullPath%
}
Gui, Show
return
MyListBox:
if A_GuiControlEvent &lt;&gt; DoubleClick
return
; Otherwise, the user double-clicked a list item, so treat that the same as pressing OK.
; So fall through to the next label.
ButtonOK:
GuiControlGet, MyListBox ; Retrieve the ListBox's current selection.
MsgBox, 4,, Would you you like to launch the file or document below?`n`n%MyListBox%
IfMsgBox, No
return
; Otherwise, try to launch it:
Run, %MyListBox%,, UseErrorLevel
if ErrorLevel = ERROR
MsgBox Could not launch the specified file. Perhaps it is not associated with anything.
return
GuiClose:
GuiEscape:
ExitApp
</pre><hr class="calibre24"/><pre class="calibre22">
Example #4: On-screen display (OSD):
CustomColor = EEAA99 ; Can be any RGB color (it will be made transparent below).
Gui, color, %CustomColor%
Gui, font, s24
Gui, add, text, vMyText cLime, XXXXX YYYYY ; XX &amp; YY serve to auto-size the window.
Gui, show, x0 y400
WinWait, A ; Set the "last found" window for use with the next two commands.
; Make all pixels of this color transparent and make the text itself translucent (150):
WinSet, TransColor, %CustomColor% 150
WinSet, AlwaysOnTop, On
; Remove the borders. Due to a quirk in Windows, this must be done after transparency:
Gui, -Caption
SetTimer, UpdateOSD, 500
return
UpdateOSD:
MouseGetPos, MouseX, MouseY
GuiControl,, MyText, X%MouseX%, Y%MouseY%
return
</pre><hr class="calibre24"/><pre class="calibre22">
Example #5: Simple image viewer. This script requires v1.0.24.
Gui, +Resize
Gui, Add, Button, default, &amp;Load New Image
Gui, Add, Radio, ym+5 x+10 vRadio checked, Load &amp;actual size
Gui, Add, Radio, ym+5 x+10, Load to &amp;fit screen
Gui, Add, Pic, xm vPic
Gui, Show
return
ButtonLoadNewImage:
FileSelectFile, file,,, Select an image:, Images (*.gif; *.jpg; *.bmp; *.png; *.tif; *.ico; *.cur; *.ani; *.exe; *.dll)
if file =
return
Gui, Submit, NoHide ; Save the values of the radio buttons.
if Radio = 1 ; Display image at its actual size.
{
width = 0
height = 0
}
else ; Second radio is selected: Resize the image to fit the screen.
{
width = %A_ScreenWidth%
Width -= 28 ; Allow room for borders and margins inside.
Height = -1 ; Keep aspect ratio seems best.
}
GuiControl,, Pic, *w%width% *h%height% %file%
Gui, Show, xCenter y0 AutoSize, %file% ; Resize the window to match the picture size.
return
GuiClose:
ExitApp</pre>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="GuiControl.htm" href="#GuiControl.htm">#</a> <h2 class="calibre17">GuiControl</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Makes a variety of changes to a control in a GUI window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GuiControl, Sub-command, ControlID [, Param3] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Sub-command</td>
<td class="calibre4">
<p class="calibre8">See list below.</p>
</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">ControlID</td>
<td width="85%" class="calibre4">
<p class="calibre8">If the target control has an associated variable, specify the variable's name as the <em class="calibre21">ControlID</em> (this method takes precedence over the ones described next). For this reason, it is usually best to assign a variable to any control that will later be accessed via GuiControl or GuiControlGet, even if that control is not an input-capable type (such as GroupBox or Text).</p>
<p class="calibre8 tbd">Otherwise, <em class="calibre21">ControlID</em> can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. Note: a picture control's file name (as it was specified at the time the control was created) may be used as its <em class="calibre21">ControlID</em>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Param3</td>
<td class="calibre4">
<p class="calibre8">This parameter is omitted except where noted in the list of sub-commands below.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the specified window/control does not exist or some other problem prevented the command from working. Otherwise, it is set to 0.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Sub-commands</strong></p>
<p class="calibre8"><strong class="calibre14">(Blank)</strong>: Leave <em class="calibre21">Sub-command</em> blank to put new contents into the control via <em class="calibre21">Param3</em>. All control types are self-explanatory except the following:</p>
<p class="calibre8"><a href="#Gui.htm__Picture" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Picture</a>: <em class="calibre21">Param3</em> should be the filename of the new image to load (see <a href="#Gui.htm__Picture" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> for supported file types). <span class="tbd">In v1.0.24+, one or more of the following options may be specified immediately in front of the filename: *wN (width N), *hN (height N), and *IconN (icon number N). In the following example, the second icon is loaded with a width of 100 and an automatic height to "keep aspect ratio": <em class="calibre21">GuiControl,, MyPic, *icon2 *w100 *h-1 C:\My Application.exe</em>. Specify <em class="calibre21">*w0 *h0</em> to use the image's actual width and height. If *w and *h are omitted, the image will be scaled to fit the current size of the control. Note: Use only one space or tab between the final option and the filename itself; any other spaces and tabs are treated as part of the filename.</span></p>
<p class="calibre8"><a href="#Gui.htm__Edit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Edit</a>: <span class="rm">Any linefeeds (`n) in <em class="calibre21">Param3</em> that lack a preceding carriage return (`r) are automatically translated to CR+LF (`r`n) to make them display properly. However, this is usually transparent because the "Gui Submit" and "GuiControlGet OutputVar" commands will automatically undo this translation by replacing CR+LF with LF (`n).</span></p>
<p class="calibre8 tbd"><a href="#Gui.htm__Hotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a>: <em class="calibre21">Param3</em> can be blank to clear the control, or a set of modifiers with a key name. Examples: ^!c, ^Numpad1, +Home. The only modifiers supported are ^ (Control), ! (Alt), and + (Shift). See the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list</a> for available key names.</p>
<p class="calibre8"><a href="#Gui.htm__Checkbox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Checkbox</a>: <em class="calibre21">Param3</em> can be 0 to uncheck the button, 1 to check it, or -1 to give it a gray checkmark. Otherwise, <em class="calibre21">Param3</em> is assumed to be the control's new caption/text. See <strong class="calibre14">Text</strong> below for how to override this behavior.</p>
<p class="calibre8 tbd"><a href="#Gui.htm__Radio" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Radio</a>: Same as Checkbox above. However, if the radio button is being checked (turned on) and it is a member of a multi-radio group, the other radio buttons in its group will be automatically unchecked.</p>
<p class="calibre8 tbd"><a href="#Gui.htm__Slider" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Slider</a>/<a href="#Gui.htm__Progress" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>: <em class="calibre21">Param3</em> should be the new position of the slider/bar. If a <em class="calibre21">Param3</em>'s first character is a plus sign, the number will be assumed to be an offset from the current position. For example, +10 would increase the position by 10 and +-10 (plus minus ten) would decrease it by 10.</p>
<p class="calibre8 tbd"><a href="#Gui.htm__Tab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Tab</a>/<a href="#Gui.htm__DropDownList" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DropDownList</a>/<a href="#Gui.htm__ComboBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ComboBox</a>/<a href="#Gui.htm__ListBox" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListBox</a>: <em class="calibre21">Param3</em> should contain a pipe-delimited list of entries to be appended at the end of the control's list. To replace (overwrite) the list instead, include a pipe as the first character (e.g. |Red|Green|Blue). To have one of the entries pre-selected, include two consecutive pipe characters after it (e.g. Red|Green||Blue). The rest of this paragraph applies only to Tab controls. A tab's sub-controls stay associated with their original tab number; that is, they are never associated with their tab's actual display-name. For this reason, renaming or deleting a tab will not change the tab number to which the sub-controls belong. For example, if there are three tabs "Red|Green|Blue" and the second tab is deleted by means of "GuiControl,, MyTab, |Red|Blue", the sub-controls originally associated with Green will now be associated with Blue.</p>
<p class="calibre8 tbd"><strong class="calibre14">Text</strong> [v1.0.22+]: Behaves the same as the above except for radio buttons and checkboxes, in which case <em class="calibre21">Param3</em> is treated as the new text/caption even if it is -1, 0, or 1.</p>
<p class="calibre8 tbd"><strong class="calibre14">Move</strong>: Moves and/or resizes the control. Specify one or more of the following option letters in <em class="calibre21">Param3</em>: X (the x-coordinate relative to the GUI window's client area, which is the area not including title bar, menu bar, and borders); Y (the y-coordinate), W (Width), H (Height). Example: x10 y20 w200 h100</p>
<p class="calibre8 tbd"><strong class="calibre14">Focus</strong>: Sets keyboard focus to the control.</p>
<p class="calibre8 tbd"><strong class="calibre14">Enable</strong> or <strong class="calibre14">Disable</strong>: Enables or disables (grays out) the control. For Tab controls, this will also enable or disable all of the tab's sub-controls. However, any sub-control explicitly disabled via "GuiControl Disable" will remember that setting and thus remain disabled even after its Tab control is re-enabled.</p>
<p class="calibre8 tbd"><strong class="calibre14">Show</strong> or <strong class="calibre14">Hide</strong>: Shows or hides the control. For Tab controls, this will also show or hide all of the tab's sub-controls.</p>
<p class="calibre8 tbd"><strong class="calibre14">Choose, ControlID, N</strong>: Sets the selection in a ListBox, DropDownList, ComboBox, or Tab control to be the Nth entry. <em class="calibre21">N</em> should be 1 for the first entry, 2 for the second, etc (if <em class="calibre21">N</em> is not an integer, the ChooseString method described below will be used instead). Unlike <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control Choose</a>, this sub-command will not trigger any <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-label</a> associated with the control unless <em class="calibre21">N</em> is preceded by a pipe character. Example: GuiControl, Choose, MyListBox, |3.</p>
<p class="calibre8 tbd">To additionally cause a finishing event to occur (a double-click in the case of ListBox), include two leading pipes instead of one (this is not supported for Tab controls).</p>
<p class="calibre8 tbd"><strong class="calibre14">ChooseString, ControlID, String</strong>: Sets the selection (choice) in a ListBox, DropDownList, ComboBox, or Tab control to be the entry whose leading part matches <em class="calibre21">String</em>. The search is not case sensitive. For example, if a the control contains the item "UNIX Text", specifying the word unix (lowercase) would be enough to select it. The pipe and double-pipe prefix are also supported (see "Choose" above details).</p>
<p class="calibre8 tbd"><strong class="calibre14">Font</strong> [v1.0.23+]: Changes the control's font to the typeface, size, color, and style currently in effect for its window. That font can be changed beforehand by means such as this example: <a href="#Gui.htm__Font" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui, Font</a>, s18 cRed Bold, Verdana </p>
<p class="calibre8 tbd"><strong class="calibre14">+/-Option1 +/-Option2 ... </strong>[v1.0.21+]: Add or remove various options and styles. All of the options described in <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Add</a> are recognized. In the following example, the <a href="#Gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a> option is enabled but control's <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-label</a> is removed:<br class="calibre12" /> GuiControl, +AltSubmit -g, MyListBox</p>
<p class="calibre8 tbd">In the next example, the OK button is made the new default button:<br class="calibre12" /> GuiControl, +Default, OK </p>
<p class="calibre8 tbd">Although styles and extended styles are also recognized, many of them cannot be applied or removed after a control has been created. Attempts to do so will silently have no effect, and in most such cases, ErrorLevel will be set to 0 (indicating "no error") rather than 1. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To operate upon a window number other than the default (see below), include a number followed by a colon in front of the sub-command as in these examples:<br class="calibre12" /> GuiControl, 2:Show, MyButton<br class="calibre12" /> GuiControl, 2:, MyListBox, Item1|Item2</p>
<p class="calibre8">A GUI <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> is defined as any thread launched as a result of a GUI action. GUI actions include selecting an item from a GUI window's menu bar, or triggering one of its <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-labels</a> (such as by pressing a button).</p>
<p class="calibre8">The default window number for a GUI thread is that of the window that launched the thread. Non-GUI threads use 1 as their default.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a>, <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">GuiControl,, MyListBox, |Red|Green|Blue ; Replace the current list with a new list.<br class="calibre12" /> GuiControl,, MyEdit, New text line 1.`nNew text line 2.<br class="calibre12" /> GuiControl,, MyRadio2, 1 ; Turn on this radio button and turn off all the others in its group.<br class="calibre12" /> GuiControl, Move, OK, x100 y200 ; Move the OK button to a new location.<br class="calibre12" /> GuiControl, Focus, LastName ; Set keyboard focus to the control whose variable or text is "LastName".</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="GuiControlGet.htm" href="#GuiControlGet.htm">#</a> <h2 class="calibre17">GuiControlGet</h2> [v1.0.20+]
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves various types of information about a control in a GUI window. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GuiControlGet, OutputVar [, Sub-command, ControlID, Param4]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the result. If the command cannot complete (see ErrorLevel below), this variable is made blank.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Sub-command</td>
<td class="calibre4">
<p class="calibre8">See list below.</p>
</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">ControlID</td>
<td width="85%" class="calibre4">
<p class="calibre8">If blank or omitted, it defaults to the control whose associated output variable is <em class="calibre21">OutputVar</em>.</p>
<p class="calibre8">If the target control has an associated variable, specify the variable's name as the <em class="calibre21">ControlID</em> (this method takes precedence over the ones described next). For this reason, it is usually best to assign a variable to any control that will later be accessed via GuiControl or GuiControlGet, even if that control is not an input-capable type (such as GroupBox or Text).</p>
<p class="calibre8">Otherwise, <em class="calibre21">ControlID</em> can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. Note: a picture control's file name (as it was specified at the time the control was created) may be used as its <em class="calibre21">ControlID</em>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Param4</td>
<td class="calibre4">
<p class="calibre8">This parameter is omitted except where noted in the list of sub-commands below.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the specified window/control does not exist or some other problem prevented the command from working. Otherwise, it is set to 0.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Sub-commands</strong></p>
<p class="calibre8"><strong class="calibre14">(Blank)</strong>: Leave <em class="calibre21">Sub-command</em> blank to retrieve the control's contents. All control types are self-explanatory except the following:</p>
<p class="calibre8">Picture: Retrieves the picture's file name as it was originally specified when the control was created. This name does not change even if a new picture file name is specified.</p>
<p class="calibre8">Edit: Any line breaks in the text will be represented as plain linefeeds (`n) rather than the traditional CR+LF (`r`n) used by non-GUI commands such as <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a> and <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>.</p>
<p class="calibre8">Hotkey: Retrieves a blank value if there is no hotkey in the control. Otherwise it retrieves the modifiers and key name. Examples: ^!C, ^Home, +^NumpadHome.</p>
<p class="calibre8">Checkbox/Radio: Retrieves 1 if the control is checked, 0 if it is unchecked, or -1 if it has a gray checkmark. To retrieve the control's text/caption instead, specify the word Text for <em class="calibre21">Param4</em>. Note: Unlike the <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui Submit</a> command, radio buttons are always retrieved individually, regardless of whether they are in a radio group.</p>
<p class="calibre8">Slider/Progress: Retrieves the current position of the slider/bar.</p>
<p class="calibre8">DropDownList/ComboBox/ListBox/Tab control: Retrieves the text of the currently selected item/tab (or its position if the control has the <a href="#gui.htm__AltSubmit" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AltSubmit</a> property). For a ComboBox, if there is no selected item, the text in the control's edit field is retrieved instead.</p>
<p class="calibre8">Note: To unconditionally retrieve any control's text/caption rather than its contents, specify the word Text for <em class="calibre21">Param4.</em></p>
<p class="calibre8"><strong class="calibre14"> Pos</strong>: Retrieves the position and size of the control. The position is relative to the GUI window's client area, which is the area not including title bar, menu bar, and borders. The information is stored in four variables whose names all start with <em class="calibre21">OutputVar</em>. Example:<br class="calibre12" /> ControlGet, MyEdit, Pos<br class="calibre12" /> MsgBox The X coordinate is %MyEditX%. The Y coordinate is %MyEditY%. The width is %MyEditW%. The height is %MyEditH%.</p>
<p class="calibre8"><strong class="calibre14">Focus</strong>: Retrieves the control identifier (ClassName+NN) for the control that currently has keyboard focus. Since the specified GUI window must be <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">active</a> for one of its controls to have focus, <em class="calibre21">OutputVar</em> will be made blank if it is not active. Example: ControlGet, focused_control, focus</p>
<p class="calibre8"><strong class="calibre14">Enabled</strong>: Retrieves 1 if the control is enabled or 0 if it is disabled. </p>
<p class="calibre8"><strong class="calibre14">Visible</strong>: Retrieves 1 if the control is visible or 0 if it is hidden.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To operate upon a window number other than the default (see below), include a number followed by a colon in front of the sub-command as in these examples:<br class="calibre12" /> GuiControlGet, MyEdit, 2:<br class="calibre12" /> GuiControlGet, MyEdit, 2:Pos<br class="calibre12" /> GuiControlGet, Outputvar, 2:Focus</p>
<p class="calibre8">A GUI <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> is defined as any thread launched as a result of a GUI action. GUI actions include selecting an item from a GUI window's menu bar, or triggering one of its <a href="#Gui.htm__label" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">g-labels</a> (such as by pressing a button).</p>
<p class="calibre8">The default window number for a GUI thread is that of the window that launched the thread. Non-GUI threads use 1 as their default.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a>, <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">GuiControlGet, MyEdit<br class="calibre12" /> GuiControlGet, CtrlContents,, MyEdit ; Same as the above except uses a non-default output variable.<br class="calibre12" /> GuiControlGet, MyCheckbox1 ; Retrieves 1 if it is checked, 0 if it is unchecked.<br class="calibre12" /> GuiControlGet, MyCheckbox1,,, Text ; Retrieves the caption/text of the checkbox. <br class="calibre12" /> GuiControlGet, Pic, Pos, Static4 ; The position/size will be stored in PicX, PicY, PicW, and PicH</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfMsgBox.htm" href="#IfMsgBox.htm">#</a> <h2 class="calibre17">IfMsgBox</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks which button was pushed by the user during the most recent <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> command.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IfMsgBox, ButtonName </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">ButtonName</td>
<td width="85%" class="calibre4">Can be any of the following strings to represent which button the user pressed in the most recent <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> command: Yes, No, OK, Cancel, Abort, Ignore, Retry, or Timeout.<br class="calibre12" /> The Timeout string is returned if the <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> timed out.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">MsgBox, 4, , Would you like to continue?, 5 ; 5-second timeout.
IfMsgBox, No, Return ; User pressed the "No" button.
IfMsgBox, Timeout, Return ; i.e. Assume "No" if it timed out.
; Otherwise, continue:
...
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="InputBox.htm" href="#InputBox.htm">#</a> <h2 class="calibre17">InputBox</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays an input box to ask the user to enter a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">InputBox, OutputVar [, Title, Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" summary="Parameters" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the text entered by the user.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Title</td>
<td class="calibre4">The title of the input box. If blank or omitted, it defaults to the name of the script. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Prompt</td>
<td class="calibre4">The text of the input box, which is usually a message to the user indicating what kind of input is expected.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">HIDE</td>
<td class="calibre4">If this parameter is the word HIDE, the user's input will be masked, which is useful for passwords.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Width</td>
<td class="calibre4">If this parameter is blank or omitted, the starting width of the window will be 375.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Height</td>
<td class="calibre4">If this parameter is blank or omitted, the starting height of the window will be 189.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X, Y </td>
<td class="calibre4">The X and Y coordinates of the window (use 0,0 to move it to the upper left corner of the desktop). If either coordinate is blank or omitted, the dialog will be centered in that dimension. Either coordinate can be negative to position the window partially or entirely off the desktop.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Font</td>
<td class="calibre4">Not yet implemented (leave blank). In the future it might accept something like verdana:8</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Timeout<br class="calibre12" /> (v1.0.09+)</td>
<td class="calibre4">(optional) Timeout in seconds (can contain a decimal point).  If this value exceeds 2147483 (24.8 days), it will be set to 2147483. After the timeout has elapsed, the InputBox window will be automatically closed and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to 2. <em class="calibre21">OutputVar</em> will still be set to what the user entered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Default<br class="calibre12" /> (v1.0.09+)</td>
<td class="calibre4">A string that will appear in the InputBox's edit field when the dialog first appears. The user can change it by backspacing or other means. </td>
</tr>
<!-- Not sure if a timeout is needed/wanted
<tr>
<td width="15%">timeout</td>
<td width="85%">(optional) Timeout in seconds.  After the timeout has
elapsed the message box will be automatically closed.</td>
</tr>
-->
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8">See below.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The dialog allows the user to enter text and then press OK or CANCEL. The user can resize the dialog window by dragging its borders. </p>
<p class="calibre8">If the user presses the CANCEL button: <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 and <em class="calibre21">OutputVar</em> to the value entered. This allows the CANCEL button to perform a function other than CANCEL should the script designer wish it.</p>
<p class="calibre8">If the dialog times out, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to 2.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Input.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Input</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>, <a href="#SplashTextOn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashTextOn</a>, <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">InputBox, password, Enter Password, (your input will be hidden), hide
InputBox, UserInput, Phone Number, Please enter a phone number., , 640, 480
if ErrorLevel &lt;&gt; 0
MsgBox, CANCEL was pressed.
else
MsgBox, You entered "%UserInput%"
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="MsgBox.htm" href="#MsgBox.htm">#</a> <h2 class="calibre17">MsgBox</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays a simple message box with one or more buttons and with optional timeout.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">MsgBox, Text<br class="calibre12" />MsgBox [, Options, Title, Text, Timeout]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Text</td>
<td class="calibre4">
<p class="calibre8">If all the parameters are omitted, the MsgBox will display the text "Press OK to continue." Otherwise, this parameter is the text displayed inside the message box to instruct the user what to do, or to present information.</p>
<p class="calibre8"><a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Escape sequences</a> can be used to denote special characters. For example, `n indicates a "newline" character, which ends the current line and begins a new one. Thus, using text1`n`ntext2 would create a blank line between text1 and text2.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">
<p class="calibre8">Indicates the type of message box and the possible button combinations.  If blank or omitted, it defaults to 0. See remarks for other allowed values.</p>
<p class="calibre8"><span class="rm">This parameter will not be recognized if it is contained in a variable reference such as %option%. Instead, use a literal numeric value.</span> </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Title</td>
<td class="calibre4">The title of the message box window. If omitted or blank, it defaults to the name of the script (without path). </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Timeout</td>
<td width="85%" class="calibre4">(optional) Timeout in seconds (can contain a decimal point).  <span class="tbd">If this value exceeds 2147483 (24.8 days), it will be set to 2147483.</span>  After the timeout has elapsed the message box will be automatically closed and the <a href="#IfMsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfMsgBox</a> command will see the value TIMEOUT.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command has smart comma handling, so it is usually not necessary to <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape</a> commas in the <em class="calibre21">Text</em> parameter.</p>
<p class="calibre8">The <em class="calibre21">Options<strong class="calibre14"> </strong></em>parameter can be a combination of the following values.</p>
<table border="1" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre31"><b class="calibre14"><i class="calibre21">Function</i></b></td>
<td width="87" class="calibre31"><b class="calibre14"><i class="calibre21"> Value</i></b></td>
</tr>
<tr class="calibre3">
<td class="calibre4">OK (i.e. just an OK button is displayed) </td>
<td class="calibre31">0</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OK/Cancel</td>
<td class="calibre31">1</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Abort/Retry/Ignore</td>
<td class="calibre31">2</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Yes/No/Cancel</td>
<td class="calibre31">3</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Yes/No</td>
<td class="calibre31">4</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Retry/Cancel</td>
<td class="calibre31">5</td>
</tr>
<tr class="calibre3">
<td class="calibre4"> </td>
<td class="calibre31"> </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Icon Hand (stop/error)</td>
<td class="calibre31">16</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Icon Question </td>
<td class="calibre31">32</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Icon Exclamation</td>
<td class="calibre31">48</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Icon Asterisk (info)</td>
<td class="calibre31">64</td>
</tr>
<tr class="calibre3">
<td class="calibre4"> </td>
<td class="calibre31"> </td>
</tr>
<tr class="calibre3">
<td class="calibre4"><span class="tbd">Make 2nd button the default </span></td>
<td class="calibre31">256</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><span class="tbd">Make 3rd button the default </span></td>
<td class="calibre31">512</td>
</tr>
<tr class="calibre3">
<td class="calibre4"> </td>
<td class="calibre31"> </td>
</tr>
<tr class="calibre3">
<td class="calibre4">System Modal (always on top)</td>
<td class="calibre31">4096</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><span class="tbd">Task Modal </span></td>
<td class="calibre31">8192</td>
</tr>
</tbody>
</table>
<p class="calibre8">For example, to specify a SYSTEMMODAL box with the YES/NO buttons the <em class="calibre21">Options</em> value would be 4096+4 (4100).</p>
<p class="calibre8">To determine which button the user pressed in the most recent MsgBox, use the <a href="#IfMsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfMsgBox</a> command.</p>
<p class="calibre8">The text on the buttons can be changed by following <a href="#MsgBoxButtonNames.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">this example</a>.</p>
<p class="calibre8"> <span class="rm">The windows shown by this command are a built-in feature of Windows.</span> As such, the X button (close) in the title bar is enabled only when certain buttons are present in the dialog: If there is only an OK button, clicking the X button is the same as pressing OK. Otherwise, the X button is disabled unless there is a Cancel button, in which case clicking the X is the same as pressing Cancel. <span class="x11">Pressing Escape on a window without a X still closes the window as if a fictional Cancel button were pressed.</span></p>
<p class="calibre8"><span class="tbd">Pressing Control-C while a MsgBox dialog is active will copy its text to the clipboard.</span> <span class="rm">This applies to all MsgBoxes, not just those produced by AutoHotkey.</span></p>
<p class="calibre8"><span class="x11">In headless mode (when there is no graphical display), MsgBox falls back to Echo.</span></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfMsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfMsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>, <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">MsgBox, This is the 1-param method. Commas, do, not, need to be escaped.
MsgBox, 4, , This is the 3-param method, non-escaped commas ok.`n`nContinue?
IfMsgBox, No
return
MsgBox, 4, , This MsgBox will time out in 5 seconds. Continue?, 5
IfMsgBox, Timeout
MsgBox, The previous MsgBox timed out.
else IfMsgBox, No
return
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Progress.htm" href="#Progress.htm">#</a> <h2 class="calibre17">Progress / SplashImage</h2> [v1.0.15+]
<hr size="2" class="calibre24" />
<p class="calibre8">Creates or modifies a window to display a progress bar or an image.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SplashImage, Off<br class="calibre12" /> SplashImage [, ImageFile, Options, SubText, MainText, WinTitle, FontName, FutureUse]<br class="calibre12" />
<br class="calibre12" /> Progress, Off<br class="calibre12" /> Progress, Param1 [, SubText, MainText, WinTitle, FontName, FutureUse]
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">ImageFile</td>
<td class="calibre4">
<p class="calibre8">The name of the BMP, GIF, or JPG image to display (to display other file formats such as PNG, TIF, and ICO, consider using the <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> command to create a window containing a picture control).</p>
<p class="calibre8"><em class="calibre21">ImageFile</em> is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. If <em class="calibre21">ImageFile</em> and <em class="calibre21">Options</em> are blank and the window already exists, its image will be unchanged but its text will be updated to reflect any new strings provided in <em class="calibre21">SubText</em>, <em class="calibre21">MainText</em>, and <em class="calibre21">WinTitle</em>.</p>
<p class="calibre8">For newly created windows, if <em class="calibre21">ImageFile</em> is blank or there is a problem loading the image, the window will be displayed without the picture.</p>
</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Param1<br class="calibre12" /> </td>
<td width="85%" class="calibre4">
<p class="calibre8"><u class="calibre20">If the progress window already exists</u>: If <em class="calibre21">Param1</em> is an integer between 0 and 100, its bar's position (percentage) is changed to that value. If <em class="calibre21">Param1</em> is blank, its bar position will be unchanged but its text will be updated to reflect any new strings provided in <em class="calibre21">SubText</em>, <em class="calibre21">MainText</em>, and <em class="calibre21">WinTitle</em>. In both of these modes, if the window doesn't yet exist, it will be created with the defaults for all options.</p>
<p class="calibre8"><u class="calibre20">If the progress window does not exist</u>: A new progress window is created (replacing any old one), and <em class="calibre21">Param1</em> is a string of zero or more options from the list below.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">A string of zero or more options from the list below.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SubText</td>
<td class="calibre4">The text to display below the image or bar indicator. Although word-wrapping will occur, to begin a new line explicitly, use linefeed (`n). To set an existing window's text to be blank, specify <a href="#Variables.htm__Space" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a>. For the purpose of auto-calculating the window's height, blank lines can be reserved in a way similar to <em class="calibre21">MainText</em> below.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MainText</td>
<td class="calibre4">
<p class="calibre8">The text to display above the image or bar indicator (its font is semi-bold). Although word-wrapping will occur, to begin a new line explicitly, use linefeed (`n).</p>
<p class="calibre8">If blank or omitted, no space will be reserved in the window for <em class="calibre21">MainText</em>. To reserve space for single line to be added later, or to set an existing window's text to be blank, specify <a href="#Variables.htm__Space" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a>. To reserve extra lines beyond the first, append one or more linefeeds (`n).</p>
<p class="calibre8">Once the height of <em class="calibre21">MainText</em>'s control area has been set, it cannot be changed without recreating the window. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title of the window. If omitted and the window is being newly created, the title defaults to the name of the script (without path). If the <strong class="calibre14">B</strong> (borderless) option has been specified, there will be no visible title bar but the window can still be referred to by this title in commands such as <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">FontName</td>
<td class="calibre4">
<p class="calibre8">The name of the font to use for both <em class="calibre21">MainText</em> and <em class="calibre21">SubText</em>. The <a href="#FontsStandard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">font table </a> lists the fonts included with the various versions of Windows. If unspecified or if the font cannot be found, the system's default GUI font will be used.</p>
<p class="calibre8">See the options section below for how to change the size, weight, and color of the font.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">FutureUse</td>
<td class="calibre4">This parameter should always be omitted. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><u class="calibre20">Window Size, Position, and Behavior </u></span></p>
<p class="calibre8"><strong class="calibre14">A</strong>: The window will <u class="calibre20">not</u> be always-on-top.</p>
<p class="calibre8"><strong class="calibre14">B</strong>: Borderless: The window will have no border and no title bar. To have a border but no title bar, use <strong class="calibre14">B1</strong> for a thin border or <strong class="calibre14">B2</strong> for a dialog style border.</p>
<p class="calibre8"><strong class="calibre14">M</strong>: The window will be movable by the user (except if borderless). To additionally make the window resizable (by means of dragging its borders), specify <strong class="calibre14">M1</strong>. To additionally include a system menu and a set of minimize/maximize/close buttons in the title bar, specify <strong class="calibre14">M2</strong>.</p>
<p class="calibre8"><strong class="calibre14">T</strong>: The window will be given a button in the task bar and it will be unowned. Normally, there is no button because the window is owned by the script's main window.</p>
<p class="calibre8"><strong class="calibre14">Hn</strong>: Specify for <strong class="calibre14">n</strong> the height of the window's client area (which is the area not including title bar and borders). If unspecified, the height will be calculated <u class="calibre20">automatically</u> based on the height of the image/bar and text in the window.</p>
<p class="calibre8"><strong class="calibre14">Wn</strong>: Specify for <strong class="calibre14">n</strong> the width of the window's client area. If unspecified, the width will be calculated <u class="calibre20">automatically</u> for SplashImage (if there is an image). Otherwise, it will default to 300.</p>
<p class="calibre8"><strong class="calibre14">Xn</strong>: Specify for <strong class="calibre14">n</strong> the x-coordinate of the window's upper left corner. If unspecified, the window will be horizontally centered on the screen. </p>
<p class="calibre8"><strong class="calibre14">Yn</strong>: Specify for <strong class="calibre14">n</strong> the y-coordinate of the window's upper left corner. If unspecified, the window will be vertically centered on the screen.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><u class="calibre20">Layout of Objects in the Window</u></span></p>
<p class="calibre8"><strong class="calibre14">Cxy</strong>: Centered: If this option is absent, both <em class="calibre21">SubText</em> and <em class="calibre21">MainText</em> will be centered inside the window. Specify 0 for <strong class="calibre14">x</strong> to make <em class="calibre21">SubText</em> left-justified. Specify a 1 to keep it centered. The same is true for <strong class="calibre14">y</strong> except that it applies to <em class="calibre21">MainText</em> (<strong class="calibre14">y</strong> can be omitted). Example: c10</p>
<p class="calibre8"><strong class="calibre14">ZHn</strong>: Height of object: For Progress windows, specify for <strong class="calibre14">n</strong> the thickness of the progress bar (default 20). For SplashImage windows, specify for <strong class="calibre14">n</strong> the height to which to scale image. In v1.0.16+, -1 can be used to make the height proportional to the width specified in ZWn (i.e. "keep aspect ratio"). If unspecified, the actual image height will be used. In either case, a value of 0 can be specified to omit the object entirely, which allows the window to be used to display only text in custom fonts, sizes, and colors.</p>
<p class="calibre8"><strong class="calibre14">ZWn</strong>: Width of object (for SplashImage windows only): Specify for <strong class="calibre14">n</strong> the width to which to scale the image. In v1.0.16+, -1 can be used to make the width proportional to the height specified in ZHn (i.e. "keep aspect ratio"). If unspecified, the actual image width will be used.</p>
<p class="calibre8"><strong class="calibre14">ZXn</strong>: Specify for <strong class="calibre14">n</strong> the amount of margin space to leave on the left/right sides of the window. The default is 10 except for SplashImage windows with no text, which have a default of 0. </p>
<p class="calibre8"><strong class="calibre14">ZYn</strong>: Specify for <strong class="calibre14">n</strong> the amount of vertical blank space to leave at the top and bottom of the window and between each control. The default is 5 except for SplashImage windows with no text, which have a default of 0. </p>
<p class="calibre8">Note: To create a vertical progress bar or to have more layout flexibility, use the <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> command such as this example:<br class="calibre12" /> Gui, Add, Progress, Vertical vMyProgress<br class="calibre12" /> Gui, Show<br class="calibre12" /> return<br class="calibre12" /> ... later... <br class="calibre12" /> GuiControl,, MyProgress, +10 ; Move the bar upward by 10 percent. Omit the + to set an absolute position.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><u class="calibre20">Font Size and Weight</u></span></p>
<p class="calibre8"><strong class="calibre14">FMn</strong>: Specify for <strong class="calibre14">n</strong> the font size for <em class="calibre21">MainText</em>. Default 0, which causes 10 to be used on most systems. This default is not affected by the system's selected font size in Control Panel &gt; Display settings. </p>
<p class="calibre8"><strong class="calibre14">FSn</strong>: Specify for <strong class="calibre14">n</strong> the font size for <em class="calibre21">SubText</em>. Default 0, which causes 8 to be used on most systems.</p>
<p class="calibre8"><strong class="calibre14">WMn</strong>: Specify for <strong class="calibre14">n</strong> the font weight of <em class="calibre21">MainText</em>. The weight should be between 1 and 1000. If unspecified, 600 (semi-bold) will be used.</p>
<p class="calibre8"><strong class="calibre14">WSn</strong>: Specify for <strong class="calibre14">n</strong> the font weight of <em class="calibre21">SubText</em>. The weight should be between 1 and 1000 (700 is traditionally considered to be "bold"). If unspecified, 400 (normal) will be used.</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><u class="calibre20">Object Colors</u></span></p>
<p class="calibre8">A color can be one of the names from the list below <u class="calibre20">or</u> a 6-digit hexadecimal RGB value. For example, specifying cw1A00FF would set a window background color with red component 1A, green component 00, and blue component FF.</p>
<p class="calibre8">Add a space after each color option if there are any more options that follow it. Example: cbRed ct900000 cwBlue</p>
<p class="calibre8"><strong class="calibre14">CBn</strong>: Color of progress bar: Specify for <strong class="calibre14">n</strong> one of the 16 primary HTML color names or a 6-digit RGB color value. If unspecified, the system's default bar color will be used. Specify the word Default to return to the system's default progress bar color.</p>
<p class="calibre8"><strong class="calibre14">CTn</strong>: Color of text: Specify for <strong class="calibre14">n</strong> one of the 16 primary HTML color names or a 6-digit RGB color value. If unspecified, the system's default text color (usually black) will be used. Specify the word Default to return to the system's default text color. </p>
<p class="calibre8"><strong class="calibre14">CWn</strong>: Color of window (background): Specify for <strong class="calibre14">n</strong> one of the 16 primary HTML color names or a 6-digit RGB color value. If unspecified, the system's color for the face of buttons will be used (specify the word Default to later return to this color). To make the background transparent on Windows 2000/XP and beyond, use <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet TransColor</a>.</p>
<p class="calibre8"> </p>
<table border="0" cellpadding="0" cellspacing="10" width="80%" class="calibre32">
<caption class="calibre33">
<b class="calibre14"><a id="Progress.htm__colors" href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Color names and RGB values</b><br class="calibre12" />
</caption>
<tbody class="calibre2">
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="black.gif" class="calibre34" />
</td>
<td class="calibre4">Black = 000000 </td>
<td width="16" class="calibre4"><img loading="lazy" src="green.gif" class="calibre34" />
</td>
<td class="calibre4">Green = 008000<br class="calibre12" />
</td>
</tr>
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="silver.gif" class="calibre34" />
</td>
<td class="calibre4">Silver = C0C0C0 </td>
<td width="16" class="calibre4"><img loading="lazy" src="lime.gif" class="calibre34" />
</td>
<td class="calibre4">Lime = 00FF00<br class="calibre12" />
</td>
</tr>
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="gray.gif" class="calibre34" />
</td>
<td class="calibre4">Gray = 808080 </td>
<td width="16" class="calibre4"><img loading="lazy" src="olive.gif" class="calibre34" />
</td>
<td class="calibre4">Olive = 808000<br class="calibre12" />
</td>
</tr>
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="white.gif" class="calibre34" />
</td>
<td class="calibre4">White = FFFFFF </td>
<td width="16" class="calibre4"><img loading="lazy" src="yellow.gif" class="calibre34" />
</td>
<td class="calibre4">Yellow = FFFF00<br class="calibre12" />
</td>
</tr>
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="maroon.gif" class="calibre34" />
</td>
<td class="calibre4">Maroon = 800000 </td>
<td width="16" class="calibre4"><img loading="lazy" src="navy.gif" class="calibre34" />
</td>
<td class="calibre4">Navy = 000080<br class="calibre12" />
</td>
</tr>
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="red.gif" class="calibre34" />
</td>
<td class="calibre4">Red = FF0000 </td>
<td width="16" class="calibre4"><img loading="lazy" src="blue.gif" class="calibre34" />
</td>
<td class="calibre4">Blue = 0000FF<br class="calibre12" />
</td>
</tr>
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="purple.gif" class="calibre34" />
</td>
<td class="calibre4">Purple = 800080 </td>
<td width="16" class="calibre4"><img loading="lazy" src="teal.gif" class="calibre34" />
</td>
<td class="calibre4">Teal = 008080<br class="calibre12" />
</td>
</tr>
<tr class="calibre3">
<td width="16" class="calibre4"><img loading="lazy" src="fuchsia.gif" class="calibre34" />
</td>
<td class="calibre4">Fuchsia = FF00FF </td>
<td width="16" class="calibre4"><img loading="lazy" src="aqua.gif" class="calibre34" />
</td>
<td class="calibre4">Aqua = 00FFFF<br class="calibre12" />
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><u class="calibre20">Remarks</u></span></p>
<p class="calibre8">If the first parameter is the word <strong class="calibre14">OFF</strong>, the window is destroyed.</p>
<p class="calibre8">Each script can display up to 10 Progress windows and 10 SplashImage windows. Each window has a number assigned to it at the time it is created. If unspecified, that number is 1 (the first). Otherwise, precede the first parameter with the number of the window followed by a colon. For example, the Progress command with 2:Off would turn off the number-2 Progress window, 2:75 would set its bar to 75%, 2: would change one or more of its text fields, and 2:B would create a new borderless Progress window. Similarly, the SplashImage command with 2:Off would turn off the number-2 SplashImage window, 2: would change one or more of its text fields, and 2:C:\My Images\Picture1.jpg would create a new number-2 SplashImage window.</p>
<p class="calibre8">Upon creation, a window that would be larger than the desktop is automatically shrunk to fit.</p>
<p class="calibre8">A naked progress bar can be displayed by specifying no <em class="calibre21">SubText</em>, no <em class="calibre21">MainText</em>, and including the following options: b zx0 zy0. A naked image can be displayed the same way except that only the B option is needed. </p>
<p class="calibre8">On Windows XP+ if there is a non-Classic theme is in effect, the interior of a progress bar may appear as a series of segments rather than a smooth continuous bar. To avoid this, specify a bar color explicitly such as cbBlue.</p>
<p class="calibre8">Use decimal (not hexadecimal) numbers for option letters that need them, except where noted. </p>
<p class="calibre8">Commands such as <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a> and <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a> can be used to change the attributes of an existing window without having to recreate it.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI</a>, <a href="#SplashTextOn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashTextOn</a>, <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">Progress, b w200, My SubText, My MainText, My Title
Progress, 50 ; Set the position of the bar to 50%.
Sleep, 4000
Progress, Off
; Create a window just to display some 18-point Courier text:
Progress, m2 b fs18 zh0, This is the Text.`nThis is a 2nd line., , , Courier New
; Create a simple SplashImage window:
SplashImage, C:\My Pictures\Company Logo.gif
; Create a borderless SplashImage window with some large text beneath the image:
SplashImage, C:\My Pictures\Company Logo.gif, b fs18, This is our company logo.
Sleep, 4000
SplashImage, Off
; Here is a working example that demonstrates how a Progress window can be
; overlayed on a SplashImage to make a professional looking Installer screen:
IfExist, C:\WINDOWS\system32\ntimage.gif, SplashImage, C:\WINDOWS\system32\ntimage.gif, A,,, Installation
Loop, %windir%\system32\*.*
{
Progress, %a_index%, %a_loopfilename%, Installing..., Draft Installtion
Sleep, 50
IfEqual, a_index, 100, break
}
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SplashTextOn.htm" href="#SplashTextOn.htm">#</a> <h2 class="calibre17">SplashTextOn / SplashTextOff</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Creates a customizable text popup window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">SplashTextOff</p>
<p class="calibre8"> SplashTextOn [, Width, Height, Title, Text]<br class="calibre12" />
</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Width</td>
<td width="85%" class="calibre4">The width in pixels of the Window. Default 200. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Height</td>
<td width="85%" class="calibre4">The height in pixels of the window. Default 0 (i.e. just the title bar will be shown).</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Title</td>
<td width="85%" class="calibre4">The title of the window. Default empty (blank). </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Text</td>
<td width="85%" class="calibre4">The text of the window. Default empty (blank).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To have more control over layout and font name/color/size, use the <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a> command with the zh0 option, which omits the bar and displays only text. Example: Progress, zh0 fs18, Some 18-point text to display.</p>
<p class="calibre8">Use the SplashTextOff command to remove an existing splash window.</p>
<p class="calibre8">The splash window is "always on top", meaning that it stays above all other normal windows. To change this, use <em class="calibre21"><a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a>, AlwaysOnTop, Off, &lt;insert title of splash window&gt;.</em> <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a> can also make the splash window transparent.</p>
<p class="calibre8"><a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a> can be used to reposition and resize the SplashText window after it has been displayed with this command.</p>
<p class="calibre8">Unlike <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>, <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashImage</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, and <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>, only one SplashText window per script is possible.</p>
<p class="calibre8">If SplashTextOn is used while the splash window is already displayed, the window will be recreated with the new parameter values. However, rather than recreating the splash window every time you wish to change its title or text, better performance can be achieved by using the following, especially if the window needs to be changed frequently:<br class="calibre12" />
<a href="#WinSetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSetTitle</a>, &lt;insert title of splash window&gt;, , NewTitle<br class="calibre12" />
<a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, Static1, NewText, &lt;insert title of splash window&gt;
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>, <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashImage</a>, <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a>, <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>, <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SplashTextOn, , , Just a simple title.<br class="calibre12" /> Sleep, 2000<br class="calibre12" /> SplashTextOn, 400, 300, Clipboard, The clipboard contains:`n%clipboard%<br class="calibre12" /> WinMove, Clipboard, , 0, 0 ; Move the splash window to the top left corner. <br class="calibre12" /> Msgbox, Press OK to dismiss the SplashText<br class="calibre12" /> SplashTextOff </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ToolTip.htm" href="#ToolTip.htm">#</a> <h2 class="calibre17">ToolTip</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Creates an always-on-top window anywhere on the screen.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">ToolTip [, Text, X, Y, WhichToolTip]</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Text</td>
<td width="85%" class="calibre4">If blank or omitted, the tooltip will be hidden. Otherwise, this parameter is the text to display in the tooltip. To create a multi-line tooltip, use the linefeed character (`n) in between each line, e.g. Line1`nLine2</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">X, Y </td>
<td width="85%" class="calibre4">The X and Y position of the tooltip relative to the active window (use <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">"CoordMode</a>, ToolTip" to change to screen coordinates). If the coordinates are omitted, the tooltip will be shown near the mouse cursor.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WhichToolTip</td>
<td class="calibre4">
<p class="calibre8">Omit this parameter if you don't need multiple tooltips to appear simultaneously. Otherwise, this is a number between 1 and 20 to indicate which tooltip window to operate upon. If unspecified, that number is 1 (the first).</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> If the X &amp; Y coordinates would cause the tooltip to run off screen, it is repositioned to be visible.</p>
<p class="calibre8">The tooltip appears until it is cleared by running the command with no parameters, until the script terminates, <span class="rm">or sometimes until it is clicked upon.</span></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, <a href="#TrayTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">TrayTip</a>, <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>, <a href="#SplashTextOn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashTextOn</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">ToolTip, Multiline`nTooltip, 100, 150
; To have a ToolTip disappear after a certain amount of time
; without having to use Sleep (which stops the current thread):
#Persistent
ToolTip, Timed ToolTip`nThis will be displayed for 5 seconds.
SetTimer, RemoveToolTip, 5000
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="TrayTip.htm" href="#TrayTip.htm">#</a> <h2 class="calibre17">TrayTip</h2> [v1.0.10+]
<p style="color: #005500 !important;text-decoration:none !important;">For now, please just use RunWait, notify-send title "text text"</p>
<hr size="2" class="calibre24" />
<p class="calibre8">Creates a balloon message window near the tray icon (requires Windows 2000/XP+).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">TrayTip [, Title, Text, Seconds, Options]</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Title</td>
<td class="calibre4">
<p class="calibre8">If all parameters are omitted, any TrayTip window currently displayed will be removed.</p>
<p class="calibre8">Otherwise, this parameter is the title of the window, which can be up to 63 characters long (characters beyond this length are not shown).</p>
<p class="calibre8">If <em class="calibre21">Title</em> is blank, the title line will be entirely omitted from the balloon window, making it vertically shorter.</p>
</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Text</td>
<td width="85%" class="calibre4">
<p class="calibre8">The message to display, which appears beneath <em class="calibre21">Title</em>. Only the first 255 characters of <em class="calibre21">Text</em> will be displayed. Carriage return (`r) or linefeed (`n) may be used to create multiple lines of text. For example: Line1`nLine2 </p>
<p class="calibre8">If this parameter is omitted or blank, any TrayTip window currently displayed will be removed. </p>
</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Seconds</td>
<td width="85%" class="calibre4">
<p class="calibre8">The approximate number of seconds to display the window, after which it will be automatically removed by the OS. Specifying a number less than 10 or greater than 30 will usually cause the minimum (10) or maximum (30) display time to be used instead. If blank or omitted, the minimum time will usually be used. </p>
<p class="calibre8">This setting is currently unreliable due to the nature of its handling by the OS. To have precise control over how long the TrayTip is displayed, use the <a href="#Sleep.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sleep</a> command followed by TrayTip with no parameters, or use <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a> as illustrated in the Examples section below.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">
<p class="calibre8">Specify one of the following numbers to have a small icon appear to the left of <em class="calibre21">Title</em>:</p>
<p class="calibre8">1: Info icon<br class="calibre12" /> 2: Warning icon<br class="calibre12" /> 3: Error icon </p>
<p class="calibre8">If omitted, it defaults to 0, which is no icon.<br class="calibre12" />
</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> TrayTip requires Windows 2000/XP+.</p>
<p class="calibre8">TrayTip windows cannot be shown if the script lacks a tray icon (via <a href="#h_NoTrayIcon.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#NoTrayIcon</a> or <em class="calibre21"><a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, tray, NoIcon</em>). Similarly, if the following REG_DWORD value exists and has been set to 0, TrayTip will not function:<br class="calibre12" /> HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced &gt;&gt; EnableBalloonTips</p>
<p class="calibre8">Windows XP usually plays a sound when displaying a balloon tip. This sound can be disabled by adding 16 to the <em class="calibre21">Options </em> parameter.</p>
<p class="calibre8"> </p>
<p class="calibre8"> <strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a>, <a href="#SplashTextOn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashTextOn</a>, <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">TrayTip, MyTitle, Multiline`nText, 20, 17
; To have more precise control over the display time without
; having to use Sleep (which stops the current thread):
#Persistent
TrayTip, Timed TrayTip, This will be displayed for 5 seconds.
SetTimer, RemoveTrayTip, 5000
return
RemoveTrayTip:
SetTimer, RemoveTrayTip, Off
TrayTip
return
; To have a TrayTip permanently displayed, use a timer to refresh it
; periodically:
SetTimer, RefreshTrayTip, 1000
Gosub, RefreshTrayTip ; Call it once to get it started right away.
return
RefreshTrayTip:
TrayTip, Refreshed TrayTip, This is a more permanent TrayTip., , 16
return
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_HotkeyInterval.htm" href="#h_HotkeyInterval.htm">#</a> <h2 class="calibre17">#HotkeyInterval</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Along with <a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a>, specifies the rate of <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> activations beyond which a warning dialog will be displayed.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#HotkeyInterval Value </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Value</td>
<td width="85%" class="calibre4">The length of the interval in milliseconds.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> Care should be taken not to make the above too lenient because if you ever inadvertently introduce an infinite loop of keystrokes (via a <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command that accidentally triggers other hotkeys), your computer could become unresponsive due to the rapid flood of keyboard events. An oversimplified example of an infinite loop of keystrokes: ^c::Send, ^c </p>
<p class="calibre8">If you want to do something like the above without triggering an infinite loop, add a $ to the hotkey definition (e.g. $#y::). See <a href="#Hotkeys.htm__prefixdollar" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey prefixes</a> for details.</p>
<p class="calibre8">If this directive is unspecified in the script, it will behave as though set to 2000. </p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> <a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p>
<p class="calibre8"> #HotkeyInterval 2000 ; This is the default value (milliseconds).<br class="calibre12" /> #MaxHotkeysPerInterval 50 ; This is the default value.</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_HotkeyModifierTimeout.htm" href="#h_HotkeyModifierTimeout.htm">#</a> <h2 class="calibre17">#HotkeyModifierTimeout</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Affects the behavior of <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> modifiers: CTRL, ALT, WIN, and SHIFT.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#HotkeyModifierTimeout Value </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Value</td>
<td width="85%" class="calibre4">The length of the interval in milliseconds. The value can be -1 so that it never times out, or 0 so that it always times out.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This directive <strong class="calibre14">need not</strong> be used if the script has the keyboard hook installed (you can see if your script uses the hook via the "View-&gt;Key history" menu item in the main window, or via the <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a> command). This is because the hook can keep track of which modifier keys (ALT/CTRL/WIN/SHIFT) the user is physically holding down and doesn't need to use the timeout.</p>
<p class="calibre8">To illustrate the effect of this directive, consider this example:<br class="calibre12" /> ^!a::Send, abcdefg </p>
<p class="calibre8">When the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command executes, the first thing it does is release the CTRL and ALT keys so that the characters get sent properly. After sending all the keys, the command doesn't know whether it can safely push back down CTRL and ALT (to match whether the user is still holding them down). But if less than the specified number of milliseconds have elapsed, it will assume that the user hasn't had a chance to release the keys yet and it will thus push them back down to match their physical state. Otherwise, the modifier keys will not be pushed back down and the user will have to release and press them again to get them to modify the same or another key.</p>
<p class="calibre8">The timeout should be set to a value less than the amount of time that the user typically holds down a hotkey's modifiers before releasing them. Otherwise, the modifiers may be restored to the down position (get stuck down) even when the user isn't physically holding them down. </p>
<p class="calibre8">You can ensure that the keyboard hook is installed, thus making the use of this directive unnecessary, by adding the line <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a> anywhere in the script (the hook is not currently supported on Win9x). Alternatively, reducing <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a> to 0 or -1 should help because it makes <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SEND</a> run more quickly.</p>
<p class="calibre8">If this is directive is unspecified in a script, it behaves as though set to 50.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#HotkeyModifierTimeout 200</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="h_Hotstring.htm" href="#h_Hotstring.htm">#</a> <h2 class="calibre17">#Hotstring</h2> [v1.0.16+]
<hr size="2" class="calibre24" />
<p class="calibre8">Changing <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstring</a> options or ending characters.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">#Hotstring EndChars NewChars </p>
<p class="calibre8">#Hotstring NewOptions</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">EndChars NewChars</td>
<td class="calibre4">
<p class="calibre8">Specify the word EndChars followed a single space and then the new ending characters. For example:<br class="calibre12" />
<em class="calibre21">#Hotstring EndChars -()[]{}':;"/\,.?!`n `t`r</em>
</p>
<p class="calibre8">Since the new ending characters are in effect globally for the entire script -- regardless of where the EndChars command appears -- there is no need to specify EndChars more than once.</p>
<p class="calibre8"><span class="tbd">The maximum number of ending characters is 100. Characters beyond this length are ignored. </span></p>
<p class="calibre8">To make tab an ending character, include `t in the list. To make space an ending character, include it between two other characters in the list (or at the beginning if the list contains less than 2 other characters).</p>
<p class="calibre8 x11">Return key is identified by \r here</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">NewOptions</td>
<td class="calibre4">
<p class="calibre8">Specify new options as described in the <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotstrings</a> section. Example: #Hotstring r s k0 c0</p>
<p class="calibre8">Unlike <em class="calibre21">EndChars</em> above, the #Hotstring directive is positional when used this way. In other words, entire sections of hotstrings can have different default options as in this example:</p>
<p class="calibre8">::btw::by the way<br class="calibre12" /> #Hotstring r c ; All the below hotstrings will use "send raw" and will be case sensitive by default.<br class="calibre12" /> ::al::airline<br class="calibre12" /> ::CEO::Chief Executive Officer<br class="calibre12" /> #Hotstring c0 ; Make all hotstrings below this point case insensitive.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotstrings</a></p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_MaxHotkeysPerInterval.htm" href="#h_MaxHotkeysPerInterval.htm">#</a> <h2 class="calibre17">#MaxHotkeysPerInterval</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Along with <a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">HotkeyInterval</a>, specifies the rate of hotkey activations beyond which a warning dialog will be displayed.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#MaxHotkeysPerInterval Value</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Value</td>
<td width="85%" class="calibre4">The maximum number of hotkeys that can be pressed in the interval specified by <a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a><a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">HotkeyInterval</a> without triggering a warning dialog.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> Care should be taken not to make the above too lenient because if you ever inadvertently introduce an infinite loop of keystrokes (via a <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command that accidentally triggers other hotkeys), your computer could become unresponsive due to the rapid flood of keyboard events. An oversimplified example of an infinite loop of keystrokes: ^c::Send, ^c </p>
<p class="calibre8">If you want to do something like the above without triggering an infinite loop, add a $ to the hotkey definition (e.g. $#y::). See <a href="#Hotkeys.htm__prefixdollar" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey prefixes</a> for details.</p>
<p class="calibre8">If this directive is unspecified in the script, it will behave as though set to 50.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> <a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#HotkeyInterval</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p>
<p class="calibre8"> #HotkeyInterval 2000 ; This is the default value (milliseconds).<br class="calibre12" /> #MaxHotkeysPerInterval 50 ; This is the default value.</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_MaxThreads.htm" href="#h_MaxThreads.htm">#</a> <h2 class="calibre17">#MaxThreads</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the maximum number of simultaneous <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#MaxThreads Value </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Value</td>
<td width="85%" class="calibre4">The maximum total number of <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> that can exist simultaneously (limit 20).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This setting is global, meaning that it needs to be specified only once (anywhere in the script) to affect the behavior of the entire script.</p>
<p class="calibre8">Although a value of 1 is allowed, it is not recommended because it would prevent new <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a> from launching whenever the script is displaying a <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> or other dialog.</p>
<p class="calibre8">Any <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> subroutine whose first line is <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>, <a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Pause</a>, <a href="#Edit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Edit</a>, <a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a>, <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>, <a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a>, <a href="#ListVars.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListVars</a>, or <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a> will always run regardless of this setting.</p>
<p class="calibre8">If this setting is lower than <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a>, it effectively overrides that setting.</p>
<p class="calibre8">If this directive is unspecified in the script, it will behave as though set to 10.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a>, <a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#HotkeyInterval</a>, <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a>, <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p>
<p class="calibre8"> #MaxThreads 2<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_MaxThreadsBuffer.htm" href="#h_MaxThreadsBuffer.htm">#</a> <h2 class="calibre17">#MaxThreadsBuffer</h2> [v1.0.08+]
<hr size="2" class="calibre24" />
<p class="calibre8">Causes some or all <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a> to buffer rather than ignore keypresses when their <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a> limit has been reached. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#MaxThreadsBuffer On|Off</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">On|Off</td>
<td width="85%" class="calibre4">
<p class="calibre8">On: All hotkey subroutines between here and the next <em class="calibre21">#MaxThreadsBuffer ON</em> directive will buffer rather than ignore presses of their hotkeys whenever their subroutines are at their <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a> limit.</p>
<p class="calibre8">Off: This is the default behavior. A hotkey press will be ignored whenever that hotkey is already running its maximum number of threads (usually 1, but this can be changed with <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a>).</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This directive is rarely used because this type of buffering, which is OFF by default, usually does more harm than good. For example, if you accidentally press a hotkey twice, having this setting ON would cause that hotkey's subroutine to automatically run a second time if its first <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> takes less than 1 second to finish (this type of buffer expires after 1 second, by design). Note that AutoHotkey buffers hotkeys in several other ways. It's just that this particular way can be detrimental, thus it is OFF by default.</p>
<p class="calibre8">The main use for this directive is to increase the responsiveness of the keyboard's auto-repeat feature. For example, when you hold down a hotkey whose <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a> setting is 1 (the default), incoming keypresses are ignored if that hotkey subroutine is already running. Thus, when the subroutine finishes, it must wait for the next auto-repeat keypress to come in, which might take 50ms or more due to being caught "in between" keystrokes of the auto-repeat cycle. This 50ms delay can be avoided by enabling this directive for any hotkey that needs the best possible response time while it is being auto-repeated. </p>
<p class="calibre8">As with all # directives, this one should not be positioned in the script as though it were a command (i.e. it is not necessary to have it contained within a subroutine). Instead, position it immediately before or after the first hotkey label you wish to have affected by it.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a>, <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a><a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">, Threads</a>, <a href="#Hotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a>, <a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a>, <a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#HotkeyInterval</a>, <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">#MaxThreadsBuffer on
#x::MsgBox, This hotkey will use this type of buffering.
#y::MsgBox, And this one too.
#MaxThreadsBuffer off
#z::MsgBox, But not this one. </pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_MaxThreadsPerHotkey.htm" href="#h_MaxThreadsPerHotkey.htm">#</a> <h2 class="calibre17">#MaxThreadsPerHotkey</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the maximum number of simultaneous <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> per <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#MaxThreadsPerHotkey Value </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Value</td>
<td width="85%" class="calibre4">The maximum number of <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> that can be launched for a given hotkey subroutine (limit 20).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This setting is used to control how many "instances" of a given <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> subroutine are allowed to exist simultaneously. For example, if a hotkey has a max of 1 and it is pressed again while its subroutine is already running, the press will be ignored. This is helpful to prevent accidental double-presses. However, if you wish these keypresses to be buffered rather than ignored -- perhaps to increase the responsiveness of the keyboard's auto-repeat feature -- use <a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a>.</p>
<p class="calibre8">Unlike <a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a>, this setting is <strong class="calibre14">not</strong> global. Instead, position it before the first hotkey label you wish to have affected by it, which will result in all subsequent hotkeys using that value until another instance of this directive is encountered.</p>
<p class="calibre8">Any <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> subroutine whose first line is <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>, <a href="#Pause.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Pause</a>, <a href="#Edit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Edit</a>, <a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a>, <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>, <a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a>, <a href="#ListVars.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListVars</a>, or <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a> will always run regardless of this setting.</p>
<p class="calibre8">The setting of <a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a> -- if lower than than this setting -- takes precedence.</p>
<p class="calibre8">If this directive is unspecified in the script, it will behave as though set to 1.</p>
<p class="calibre8"> </p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> <a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a>, <a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#Hotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a>, <a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a>, <a href="#h_HotkeyInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#HotkeyInterval</a>, <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p>
<p class="calibre8"> #MaxThreadsPerHotkey 3 <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="h_UseHook.htm" href="#h_UseHook.htm">#</a> <h2 class="calibre17">#UseHook</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Forces the use of the hook to implement all or some <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#UseHook [On|Off]</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Hotkey.htm" href="#Hotkey.htm">#</a> <h2 class="calibre17">Hotkey</h2> [v1.0.11+]
<hr size="2" class="calibre24" />
<p class="calibre8">Creates, modifies, enables, or disables a hotkey while the script is running.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Hotkey, KeyName [, Label, Options]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">KeyName</td>
<td width="85%" class="calibre4">
<p class="calibre8">Name of the hotkey's activation key, including any <a href="#Hotkeys.htm__symbols" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">modifier symbols</a>. For example, specify #c for the Win+C hotkey.</p>
<p class="calibre8">If <em class="calibre21">KeyName</em> already exists as a hotkey, that hotkey will be updated with the values of the other parameters below. For this purpose, <em class="calibre21">KeyName</em> is not case sensitive.</p>
<p class="calibre8"><em class="calibre21">KeyName</em> can also be the name of a hotkey label (i.e. a double-colon label), which will cause that hotkey to be updated with the values of the other parameters below.</p>
<p class="calibre8">When specifying an existing hotkey, the order of the modifier symbols must match the order used when the hotkey was created. For example, ^!c is not the same as !^c for matching purposes. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Label</td>
<td class="calibre4">
<p class="calibre8">The label name whose contents will be executed (as a new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a>) when the hotkey is pressed. Both normal labels and hotkey (double-colon) labels can be used.</p>
<p class="calibre8">This parameter can be left blank if <em class="calibre21">KeyName</em> already exists as a hotkey, in which case its label will not be changed. This is done to change the hotkey's <em class="calibre21">Options</em> without changing its label.</p>
<p class="calibre8">If the label is specified but the hotkey is disabled from a previous use of this command, the hotkey will still be disabled afterward. To turn it on, use "Hotkey, KeyName, On" immediately afterward.</p>
<p class="calibre8">This parameter can also be one of the following special values:</p>
<p class="calibre8"><strong class="calibre14">On</strong>: The hotkey is re-enabled.</p>
<p class="calibre8"><strong class="calibre14">Off</strong>: The hotkey is disabled.</p>
<p class="calibre8"><strong class="calibre14">Toggle</strong> [v1.0.12+]: The hotkey is set to the opposite state (enabled or disabled).</p>
<p class="calibre8"><strong class="calibre14">AltTab</strong> (and others): These are special Alt-Tab hotkey actions, which are described <a href="#Hotkeys.htm__AltTab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">here</a>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">
<p class="calibre8">A string of zero or more of the following letters with optional spaces in between. Example: B0 T5</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">B</strong> or <strong class="calibre14">B0</strong>: Specify the letter B to buffer the hotkey as described in <a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a>. Specify B0 (B with the number 0) to disable this type of buffering.</p>
</div>
<p class="calibre8"><strong class="calibre14">Pn</strong>: Specify the letter P followed by the hotkey's <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread priority</a>. If the P option is omitted when creating a hotkey, 0 will be used. Requires v1.0.16+ </p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">Tn</strong>: Specify the letter T followed by a the number of threads to allow for this hotkey as described in <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a>. Example: T5</p>
<p class="calibre8">If either or both of the <strong class="calibre14">B</strong> and <strong class="calibre14">T</strong> option letters are omitted and the hotkey already exists, those options will not be changed. But if the hotkey does not yet exist -- that is, it's about to be created by this command -- the options will default to those most recently in effect. For example, the instance of <a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a> that occurs closest to the bottom of the script will be used. If <a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a> does not appear in the script, its default setting (OFF in this case) will be used.</p>
</div>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Creating hotkeys via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">double-colon labels</a> performs better than using this command because the hotkeys can all be enabled as a batch (rather than one by one) when the script starts. Therefore, it is best to use this command to create only those hotkeys whose key names are not known until after the script has started running. One such case is when a script's hotkeys for various actions are configurable via an <a href="#IniRead.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">INI file</a>.</p>
<p class="calibre8">A given label can be the target of more than one hotkey. If it is known that a label was called by a hotkey, you can determine which hotkey by using <a href="#Variables.htm__ThisHotkey" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_ThisHotkey%</a>.</p>
<p class="calibre8">If the script is <a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">suspended</a>, newly added/enabled hotkeys will also be suspended until the suspension is turned off (unless they're exempt as described in the <a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Suspend</a> section).</p>
<p class="calibre8">The <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> and/or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hooks will be installed or removed if justified by the changes made by this command.</p>
<p class="calibre8">Once a script has at least one hotkey, it becomes persistent, meaning that <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> rather than Exit should be used to terminate it. In v1.0.16+, hotkey scripts are also automatically <a href="#h_SingleInstance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#SingleInstance</a> unless <em class="calibre21">#SingleInstance Off</em> has been specified.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Hotkeys.htm__symbols" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey Symbols</a>, <a href="#h_MaxThreadsBuffer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsBuffer</a>, <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a>, <a href="#Suspend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Suspend</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#Thread.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Thread</a>, <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">Hotkey, ^!z, MyLabel</p>
<p class="calibre8">Hotkey, RCtrl &amp; RShift, AltTab ; Makes RCtrl &amp; RShift operate like Alt-Tab. </p>
<p class="calibre8">Hotkey, #c, On</p>
<p class="calibre8">Hotkey, $+#c, Off</p>
<p class="calibre8">Hotkey, ^!a, , T5 ; Change the hotkey to allow 5 threads. </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ListHotkeys.htm" href="#ListHotkeys.htm">#</a> <h2 class="calibre17">ListHotkeys</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays the hotkeys in use by the current script, whether their subroutines are currently running, and whether or not they use the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hook.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ListHotkeys</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to selecting the View-&gt;Hotkeys menu item in the main window.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a>, <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallMouseHook</a>, <a href="#h_UseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#UseHook</a>, <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>, <a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a>, <a href="#ListVars.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListVars</a>, <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a>, <a href="#h_MaxHotkeysPerInterval.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxHotkeysPerInterval</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">ListHotkeys</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Reload.htm" href="#Reload.htm">#</a> <h2 class="calibre17">Reload</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Replaces the currently running instance of the script with a new one. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Reload </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is useful for scripts that are frequently changed. By assigning a hotkey to this command, you can easily restart the script after saving your changes in an editor.</p>
<p class="calibre8">When the script restarts, it is launched in its original working directory (the one that was in effect when it was first launched). In other words, <a href="#SetWorkingDir.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWorkingDir</a> will not change the working directory that will be used for the new instance. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Edit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Edit</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">^!r::Reload ; Assign a hotkey to restart the script.</p>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="h_InstallKeybdHook.htm" href="#h_InstallKeybdHook.htm">#</a> <h2 class="calibre17">#InstallKeybdHook</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Forces the unconditional installation of the keyboard hook.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#InstallKeybdHook</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="h_InstallMouseHook.htm" href="#h_InstallMouseHook.htm">#</a> <h2 class="calibre17">#InstallMouseHook</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Forces the unconditional installation of the mouse hook.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#InstallMouseHook</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="BlockInput.htm" href="#BlockInput.htm">#</a> <h2 class="calibre17">BlockInput</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Disables or enables the user's ability to interact with the computer via keyboard, mouse, and perhaps other input devices. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">BlockInput, Mode </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Mode</td>
<td width="85%" class="calibre4">
<p class="calibre8">One of the following words:</p>
<p class="calibre8"><strong class="calibre14">On</strong>: The user is prevented from interacting with the computer (mouse and keyboard input has no effect). </p>
<p class="calibre8"><strong class="calibre14">Off</strong>: Input is re-enabled.</p>
<p class="calibre8"> </p>
<p class="calibre8">In v1.0.19+, the following additional modes are available (except on Windows 95/98/Me). These modes operate independently of the above two modes. In other words, "BlockInput On" will continue to block input until "BlockInput Off" is used, even if one of the below modes is also in effect.</p>
<p class="calibre8"><strong class="calibre14">Send</strong>: Input blocking is automatically enabled prior to each use of <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> or <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SendRaw</a>. This prevents any keystrokes physically typed by the user from disrupting the flow of simulated keystrokes. Input blocking is automatically turned back off after the command completes unless it was on beforehand.</p>
<p class="calibre8"><strong class="calibre14">Mouse</strong>: Input blocking is automatically enabled prior to each use of <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, or <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>. This prevents any physical mouse activity by the user from disrupting the simulated mouse events. Input blocking is automatically turned back off after the command completes unless it was on beforehand.</p>
<p class="calibre8"><strong class="calibre14">SendAndMouse</strong>: A combination of the above two modes.</p>
<p class="calibre8"><strong class="calibre14">Default</strong>: Turns off both the <em class="calibre21">Send</em> and the <em class="calibre21">Mouse</em> modes, but does not change the current state of input blocking. For example, if "BlockInput On" is currently in effect, using "BlockInput Default" will not turn it off. This is also true for "BlockInput Send|Mouse|SendAndMouse".</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"><strong class="calibre14">Note</strong>: In versions prior to 1.0.19, if BlockInput is ON, the ALT keypress cannot be sent by the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command. In later versions, input blocking is automatically and momentarily disabled whenever an ALT event is sent (then re-enabled afterward).</p>
<p class="calibre8">The table below shows how BlockInput behavior varies depending on Windows' version; however, pressing Ctrl+Alt+Del on any platform will re-enable input due to a Windows API feature.</p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="37%" class="calibre4"><strong class="calibre14"><em class="calibre21">Operating System </em></strong></td>
<td width="63%" class="calibre4"><strong class="calibre14"><em class="calibre21">"BlockInput" Results </em></strong></td>
</tr>
<tr class="calibre3">
<td class="calibre4" />
<td class="calibre4" />
</tr>
<tr class="calibre3">
<td class="calibre4">Windows 95 </td>
<td class="calibre4">No effect. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Windows 98/Me</td>
<td class="calibre4">User input is blocked and AutoHotkey is <strong class="calibre14">unable</strong> to simulate input. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Windows NT 4 (<em class="calibre21">without </em> ServicePack 6) </td>
<td class="calibre4">No effect. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Windows NT 4 (<em class="calibre21">w</em><em class="calibre21">ith </em> ServicePack 6) </td>
<td class="calibre4">User input is blocked but AutoHotkey can simulate most input. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Windows 2000/XP</td>
<td class="calibre4">User input is blocked but AutoHotkey can simulate most input. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> Note that commands such as <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a> will still work on Windows 98/Me when BlockInput is enabled. <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend </a>might also work. </p>
<p class="calibre8"> Input will be automatically enabled when the script closes. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a>, <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">if A_OSType &lt;&gt; WIN32_WINDOWS ; i.e. it's not Windows 9x.
BlockInput, on
Run, notepad
WinWaitActive, Untitled - Notepad
Send, {F5} ; pastes time and date
BlockInput, off</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ControlSend.htm" href="#ControlSend.htm">#</a> <h2 class="calibre17">ControlSend / ControlSendRaw </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sends simulated keystrokes to a window or control. <span class="x11">This does not work on some windows. Probably not fixable. Doing `WinActivate` and `Send` instead should always work regardless of the program.</span></p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">ControlSend [, <span class="tbd">Control</span>, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]</p>
<p class="calibre8">Note: ControlSendRaw uses the same parameters.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Control</td>
<td width="85%" class="calibre4"><span class="tbd">Can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. If this parameter is blank or omitted, the target window's topmost control will be used. In v1.0.08+, if this parameter is ahk_parent, the keystrokes will be sent directly to the control's parent window (see <a href="#Winamp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Automating Winamp</a> for an example).</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">Keys</td>
<td class="calibre4">
<p class="calibre8">The sequence of keys to send (see the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command for details). To send a literal comma, <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape</a> it (`,). The rate at which characters are sent is determined by <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>.</p>
<p class="calibre8">Unlike the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command, mouse clicks cannot be sent by ControlSend.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">ControlSendRaw (a command available in v1.0.16+) sends the keystrokes in the <em class="calibre21">Keys</em> parameter exactly as they appear rather than translating {Enter} to an ENTER keystroke, ^c to Control-C, etc. </p>
<p class="calibre8">If the <em class="calibre21">Control</em> parameter is omitted, this command will attempt to send directly to the target window by sending to its topmost control (which is often the correct one) or the window itself if there are no controls. This is useful if a window does not appear to have any controls at all, or just for the convenience of not having to worry about which control to send to.</p>
<p class="calibre8">By default, modifier keystrokes (Control, Alt, Shift, and Win) are sent as they normally would be by the Send command. This allows command prompt and other console windows to properly detect uppercase letters, control characters, etc. It may also improve reliability in other ways.</p>
<p class="calibre8"><a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a> should be avoided when using ControlSend against a console window such as command prompt. This is because it might prevent capitalization and modifier keys such as Control from working properly.</p>
<p class="calibre8">However, in some cases these modifier events may interfere with the active window, especially if the user is actively typing during a ControlSend or if the Alt key is being sent (since Alt activates the active window's menu bar). In v1.0.21+, this can be avoided by explicitly sending modifier up and down events as in this example:<br class="calibre12" /> ControlSend, Edit1, {Alt down}f{Alt up}, Untitled - Notepad</p>
<p class="calibre8">The value of <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a> determines the speed at which keys are sent.</p>
<p class="calibre8">If the target control is an Edit control (or something similar), the following are usually more reliable and faster than ControlSend:<br class="calibre12" />
<a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, EditPaste, This text will be inserted at the caret position., ControlName, WinTitle<br class="calibre12" />
<a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, ControlName, This text will entirely replace any current text., WinTitle
</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send, </a><a href="#Winamp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Automating Winamp</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8"> ControlSend, Edit1, This is a line of text in the notepad window., Untitled</p>
<p class="calibre8">SetTitleMatchMode, 2<br class="calibre12" /> ControlSend, , abc, cmd.exe ; Send directly to a command prompt window.</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="GetKeyState.htm" href="#GetKeyState.htm">#</a> <h2 class="calibre17">GetKeyState</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks if a keyboard key or mouse/joystick button is down or up. Also retrieves joystick status.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GetKeyState, OutputVar, KeyName [, Mode] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of the variable in which to store the retrieved key state, which is either D for down or U for up. The variable will be empty (blank) if the state of the key could not be determined.</p>
<p class="calibre8 tbd">The items below apply only to joysticks:</p>
<p class="calibre8 tbd">1) For joystick axes such as JoyX [v1.0.10+], <em class="calibre21">OutputVar</em> will be set to a floating point number between 0 and 100 to indicate the joystick's position as a percentage of that axis's range of motion. The format of the number can be changed via <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>. This <a href="#JoystickTest.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">test script</a> can be used to analyze your joystick(s).</p>
<p class="calibre8 tbd">2) When <em class="calibre21">KeyName</em> is JoyPOV [v1.0.10+], the retrieved value will be between 0 and 35900. The following approximate POV values are used by many joysticks:<br class="calibre12" /> -1: no angle to report<br class="calibre12" /> 0: forward POV<br class="calibre12" /> 9000 (i.e. 90 degrees): right POV <br class="calibre12" /> 27000 (i.e. 270 degrees): left POV<br class="calibre12" /> 18000 (i.e. 180 degrees): backward POV</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">KeyName</td>
<td class="calibre4">
<p class="calibre8">This can be just about any single character from the keyboard or one of the key names from the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list</a>, such as a mouse/joystick button. Examples: B, 5, LWin, RControl, Alt, Enter, Escape, LButton, MButton, Joy1.</p>
<p class="calibre8 tbd">In v1.0.22+, an explicit virtual key code such as vkFF may also be specified. This is useful in the rare case where a key has no name and produces no visible character when pressed. Its virtual key code can be determined by following the steps at the bottom fo the <a href="#KeyList.htm__SpecialKeys" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list page</a>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Mode</td>
<td class="calibre4">
<p class="calibre8">If omitted, the mode will default to that which retrieves the logical state of the key. This is the state that the OS and the active window believe the key to be in, but is not necessarily the same as the physical state.</p>
<p class="calibre8 tbd">Alternatively, one of these letters may be specified:<br class="calibre12" /> P = Retrieve the physical state (i.e. whether the user is physically holding it down) <br class="calibre12" /> T = Retrieve the <em class="calibre21">toggle</em> state (only valid for keys that can be toggled such as Capslock, Numlock, and Scrolllock). A retrieved value of D means the key is "on", while U means it's "off". Retrieving the <em class="calibre21">toggle</em> state might be less reliable on Windows 9x. For example, immediately after the key is pressed, its new state might not be retrieved correctly until after a the display of a window that's associated with the script, such as a <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>.</p>
<p class="calibre8">This parameter is ignored when retrieving joystick status.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 x11">Keys are only detected as pressed down when you did press them **after** the script started. In other words, GetKeyState does not work as expected at the very beginning of a script.</p>
<p class="calibre8">To wait for a key or mouse/joystick button to achieve a new state, it is usually easier to use <a href="#KeyWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyWait</a> instead of a GetKeyState loop.</p>
<p class="calibre8 tbd">The physical state of a key or mouse button will usually be the same as the logical state unless the keyboard and/or mouse hooks are installed, in which case it will accurately reflect whether or not the user is physically holding down the key or button. You can determine if your script is using the hooks via the <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a> command or menu item. You can force either or both of the hooks to be installed by adding the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a> and <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallMouseHook</a> directives to the script. </p>
<p class="calibre8 tbd">The following script demonstrates how to use GetKeyState to convert a joystick into a two-button mouse by remapping its buttons and axis control: <a href="#JoystickMouse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">JoystickMouse Script</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#KeyWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyWait</a>, <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Key List</a>, <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>, <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a>, <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallMouseHook</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">; Basic examples: <br class="calibre12" /> GetKeyState, state, Shift <br class="calibre12" /> GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.<br class="calibre12" /> GetKeyState, state, RButton ; Right mouse button. <br class="calibre12" /> GetKeyState, state, Joy2 ; The second button of the first joystick. </p>
<pre class="calibre22">; Remapping example:
; In this case, the mouse button is kept held down while NumpadAdd
; is down, which effectively transforms NumpadAdd into a mouse button.
; This method can also be used to repeat an action while the user is
; holding down a key or button:
*NumpadAdd::
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
Loop
{
Sleep, 10
GetKeyState, state, NumpadAdd, P
if state = U ; The key has been released, so break out of the loop.
break
; ... insert here any other actions you want repeated.
}
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
; Example: Make joystick button behavior depend on joystick axis position.
joy2::
GetKeyState, joyx, JoyX
if joyx &gt; 75
MsgBox Action #1 (button pressed while joystick was pushed to the right)
else if joyx &lt; 25
MsgBox Action #2 (button pressed while joystick was pushed to the left)
else
MsgBox Action #3 (button pressed while joystick was centered horizontally)
return
; See the <a href="#JoystickMouse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Joystick-To-Mouse</a> script for a more elaborate example.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="KeyHistory.htm" href="#KeyHistory.htm">#</a> <h2 class="calibre17">KeyHistory</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays script info and a history of the 20 most recent keystrokes and mouse clicks.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">KeyHistory</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to selecting the "View-&gt;Key history" menu item in the main window.</p>
<p class="calibre8">Although the 40 most recent keyboard and mouse events are displayed, because each keystroke or mouse click consists of a down-event and an up-event, only 20 "complete" events are shown.</p>
<p class="calibre8">This feature is intended to help debug scripts and hotkeys. It can also be used to detect the scan code of a non-standard keyboard key using the steps described at the bottom of the <a href="#KeyList.htm__SpecialKeys" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list</a> page (knowing the scan code allows such a key to be made into a hotkey).</p>
<p class="calibre8">If the script does not have the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a> installed, the KeyHistory window will display only the keyboard events generated by the script itself (i.e. not the user's). If the script does not have the <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse hook</a> installed, mouse button events will not be shown.</p>
<p class="calibre8">The KeyHistory command also reports other information about the script such as whether it is currently using either of the hooks. You can also force the hooks to be installed by adding either or both of the following lines to the script:<br class="calibre12" />
<a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a><br class="calibre12" />
<a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallMouseHook</a>
</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a>, <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallMouseHook</a>, <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a>, <a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a>, <a href="#ListVars.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListVars</a>, <a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a>, <a href="#KeyWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyWait</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">KeyHistory ; Display the history info in a window.
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="KeyWait.htm" href="#KeyWait.htm">#</a> <h2 class="calibre17">KeyWait</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits for a key or mouse/joystick button to be released or pressed down. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">KeyWait, KeyName [, Options]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">KeyName</td>
<td width="85%" class="calibre4">
<p class="calibre8">This can be just about any single character from the keyboard or one of the key names from the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list</a>, such as a mouse/joystick button. Joystick attributes other than buttons are not supported.</p>
<p class="calibre8 tbd">An explicit virtual key code such as vkFF may also be specified. This is useful in the rare case where a key has no name and produces no visible character when pressed. Its virtual key code can be determined by following the steps at the bottom fo the <a href="#KeyList.htm__SpecialKeys" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list page</a>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">
<p class="calibre8">If this parameter is blank, the command will wait indefinitely for the specified key or mouse/joystick button to be physically released by the user. <span class="rm">However, if the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a> is not installed and <em class="calibre21">KeyName</em> is a keyboard key released artificially by means such as the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command, the key will be seen as having been physically released. The same is true for mouse buttons when the <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse hook </a>is not installed.</span></p>
<p class="calibre8">Options: A string of one or more of the following letters (in any order, with optional spaces in between):</p>
<p class="calibre8"><strong class="calibre14">D</strong>: Wait for the key to be pushed down.</p>
<p class="calibre8 rm"><strong class="calibre14">L</strong>: Check the logical state of the key, which is the state that the OS and the active window believe the key to be in (not necessarily the same as the physical state). This parameter is ignored for joystick buttons.</p>
<p class="calibre8"><strong class="calibre14">T</strong>: Timeout (e.g. T3). The number of seconds to wait before timing out and setting <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 1. This value can be a floating point number such as 2.5, but it should not be a hexadecimal value such as 0x03. </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the command timed out or 0 otherwise. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 x11">Keys are only detected as pressed down when you did press them **after** the script started. In other words, KeyWait does not work as expected at the very beginning of a script, unless you are using the D option.</p>
<p class="calibre8 rm">The physical state of a key or mouse button will usually be the same as the logical state unless the keyboard and/or mouse hooks are installed, in which case it will accurately reflect whether or not the user is physically holding down the key. You can determine if your script is using the hooks via the <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a> command or menu item. You can force either or both of the hooks to be installed by adding the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a> and <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallMouseHook</a> directives to the script.</p>
<p class="calibre8">If the key or button achieves the specified state, the command will not wait for the timeout (if any) to expire. Instead, it will immediately set <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 0 and the script will continue executing.</p>
<p class="calibre8">While the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a>, <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Key List</a>, <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>, <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a>, <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallMouseHook</a>, <a href="#ClipWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ClipWait</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Example #1: Basic usage:
KeyWait, a ; Wait for the A key to be released.
KeyWait, LButton, D ; Wait for the left mouse button to be pressed down.
KeyWait, Joy1, D T3 ; Wait up to 3 seconds for the first joystick button to be pressed down.
KeyWait, LAlt, L ; Wait for the left-alt key to be logically released.
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #2: A simple hotkey:
~Capslock::
KeyWait, Capslock ; Wait for user to physically release it.
MsgBox You pressed and released the Capslock key.
return
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #3: Remapping a key or mouse button:
; The left mouse button is kept held down while NumpadAdd is down,
; which effectively transforms NumpadAdd into the left mouse button.
*NumpadAdd::
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
KeyWait, NumpadAdd ; Wait for the key to be released.
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #4: Detects when a key has been double-pressed (similar to double-click).
; KeyWait is used to stop the keyboard's auto-repeat feature from creating an unwanted
; double-press when you hold down the RControl key to modify another key. It does this by
; keeping the hotkey's thread running, which blocks the auto-repeats by relying upon
; #MaxThreadsPerHotkey being at its default setting of 1.
; Note: There is a more elaborate script to distinguish between single, double, and
; triple-presses at the bottom of the <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a> page.
~RControl::
if A_PriorHotkey &lt;&gt; ~RControl
{
KeyWait, RControl
return
}
if A_TimeSincePriorHotkey &gt; 400 ; Too much time between presses, so this isn't a double-press.
{
KeyWait, RControl
return
}
MsgBox You double-pressed the right control key.
return</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Input.htm" href="#Input.htm">#</a> <h2 class="calibre17">Input</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits for the user to type a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Input [, OutputVar, Options, EndKeys, MatchList] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">
<p class="calibre8">OutputVar</p>
</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of the variable in which to store the text entered by the user (by default, artificial input is also captured).</p>
<p class="calibre8">If this and the other parameters are omitted, any input in progress in another <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> is terminated and its <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the word NewInput. By contrast, the <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> of the current command will be set to 0 if it terminated a prior input or 1 if there was no prior input to terminate.</p>
<p class="calibre8">Non-character keys such as PageUp and Escape are not stored. Whitespace characters such as TAB are stored literally. ENTER is stored <span class="tbd">as linefeed (`n) in v1.0.16+</span> <span class="x11">as carriage return (`r)</span></p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">
<p class="calibre8"><u class="calibre20">A string of zero or more of the following letters (in any order, with optional spaces in between):</u></p>
<p class="calibre8"><strong class="calibre14">B</strong>: Backspace is ignored. Normally, pressing backspace during an input will remove the most recently pressed character from the end of the string. Note: If the input text is visible (such as in an editor) and the arrow keys or other means are used to navigate within it, backspace will still remove the last character rather than the one behind the caret (insert position).</p>
<p class="calibre8"><strong class="calibre14">C</strong>: Case sensitive. Normally, <em class="calibre21">MatchList</em> is not case sensitive.</p>
<p class="calibre8"><strong class="calibre14">I</strong>: Ignore input generated by AutoHotkey itself, such as the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command. </p>
<p class="calibre8"><strong class="calibre14">L</strong>: Length limit (e.g. L5). The maximum allowed length of the input. When the text reaches this length, the input will be terminated and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to the word Max unless the text matches one of the <em class="calibre21">MatchList</em> phrases, in which case <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the word Match. If unspecified, the length limit is 16383, which is also the absolute maximum.</p>
<p class="calibre8 tbd"><strong class="calibre14">M</strong> [v1.0.21+]: Modified keystrokes such as Control-A through Control-Z are recognized and transcribed if they correspond to real ASCII characters. Consider this example, which recognizes Control-C:<br class="calibre12" /> Transform, CtrlC, Chr, 3 ; Store the character for Ctrl-C in the CtrlC var. <br class="calibre12" /> Input, OutputVar, L1 M<br class="calibre12" /> if OutputVar = %CtrlC%<br class="calibre12" />      MsgBox, You pressed Control-C.<br class="calibre12" /> ExitApp</p>
<p class="calibre8 tbd">Note: The characters Ctrl-A through Ctrl-Z correspond to "Chr 1" through "Chr 26". Also, the <strong class="calibre14">M </strong>option might cause some keyboard shortcuts such as Ctrl-LeftArrow to misbehave while an Input is in progress.</p>
<p class="calibre8"><strong class="calibre14">T</strong>: Timeout (e.g. T3). The number of seconds to wait before terminating the input and setting <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to the word Timeout. If the input times out, <em class="calibre21">OutputVar</em> will be set to whatever text the user had time to enter. This value can be a floating point number such as 2.5.</p>
<p class="calibre8"><strong class="calibre14">V</strong>: Visible. Normally, the user's input is hidden from the system (suppressed). Use this option to have the user's keystrokes sent to the active window.</p>
<p class="calibre8"><strong class="calibre14">*</strong>: Wildcard (find anywhere). Normally, what the user types must exactly match one of the <em class="calibre21">MatchList</em> phrases for a match to occur. By contrast, this option finds a match more often because it searches the entire length of the input text.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">EndKeys</td>
<td class="calibre4">
<p class="calibre8">A list of zero or more keys, any one of which terminates the input when pressed (the <em class="calibre21">EndKey</em> itself is not written to <em class="calibre21">OutputVar</em>). When an input is terminated this way, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the word EndKey followed by a colon and the name of the <em class="calibre21">EndKey, </em>e.g. EndKey:. or EndKey:Escape.</p>
<p class="calibre8">The <em class="calibre21">EndKey</em> list uses a format similar to the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command. For example, specifying {Enter}.{Esc} would cause either ENTER, period (.), or ESCAPE to terminate the input.</p>
<p class="calibre8">To use Control, Alt, or Shift as end-keys, specify the left and/or right version of the key, not the neutral version. For example, specify {LControl}{RControl} rather than {Control}.</p>
<p class="calibre8 tbd">Although modified keys such as Control-C (^c) are not supported, certain keys that require the shift key to be held down -- namely punctuation marks such as ?!:@&amp;{} -- are supported in v1.0.14+.</p>
<p class="calibre8 tbd">An explicit virtual key code such as {vkFF} may also be specified. This is useful in the rare case where a key has no name and produces no visible character when pressed. Its virtual key code can be determined by following the steps at the bottom fo the <a href="#KeyList.htm__SpecialKeys" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list page</a>.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MatchList</td>
<td class="calibre4">
<p class="calibre8">A comma-separated list of key phrases, any of which will cause the input to be terminated (in which case <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to the word Match). <strong class="calibre14">Any spaces or tabs around the delimiting commas are significant</strong>, meaning that they are part of the match string. For example, if <em class="calibre21">MatchList</em> is "ABC , XYZ ", the user must type a space after ABC or before XYZ to cause a match.</p>
<p class="calibre8">Two consecutive commas results in a single literal comma. For example, the following would produce a single literal comma at the end of string: "string1,,,string2". Similarly, the following list contains only a single item with a literal comma inside it: "single,,item".</p>
<p class="calibre8">Because the items in <em class="calibre21">MatchList</em> are not treated as individual parameters, the list can be contained entirely within a variable. <span class="tbd">In fact, all or part of it must be contained in a variable if its length exceeds 16383 since that is the maximum length of any script line. For example, <em class="calibre21">MatchList</em> might consist of %List1%,%List2%,%List3% -- where each of the sublists contains a large list of match phrases.</span></p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">
<p class="calibre8">1 or 0 </p>
</td>
<td width="85%" class="calibre4">
<p class="calibre8">Whenever the command is used without parameters, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0 if it successfully terminates a prior input, or 1 if there is no input in progress.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">NewInput</td>
<td class="calibre4">The input was interrupted by another <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> that used the Input command. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Max</td>
<td class="calibre4">The input reached the maximum allowed length and it does not match any of the items in <em class="calibre21">MatchList</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Timeout</td>
<td class="calibre4">The input timed out. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Match</td>
<td class="calibre4">The input matches one of the items in <em class="calibre21">MatchList</em>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">EndKey:name</td>
<td class="calibre4">One of the <em class="calibre21">EndKeys</em> was pressed to terminate the input. In this case, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> contains the word EndKey followed by a colon and the name of the terminating key without braces, e.g. EndKey:Enter, EndKey:Escape, etc.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If this command is used while an input is already in progress in another <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a>, that input will be terminated and its <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to the word NewInput. After that (if parameters were given), the new input will commence.</p>
<p class="calibre8">Hotkeys are still in effect while the input is in progress; in other words, pressing a hotkey will have its normal effect. Similarly, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu items</a> will still function and <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed subroutines</a> will still run. </p>
<p class="calibre8 rm">When a script first uses this command, the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a> will be installed automatically if it isn't already present. Once that happens, the script becomes <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a>, meaning that <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> should be used to terminate it.</p>
<p class="calibre8">Although not as flexible, <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstrings</a> are generally easier to use than the Input command.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotstrings</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#InstallKeybdHook</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">; This is a working hotkey example. Since the hotkey has the tilde (~)
; prefix, its own keystroke will pass through to the active window
; (except on Win9x). Thus, if you type [btw (or one of the other match
; phrases) in any editor, the script will automatically perform an
; action of your choice (such as replacing the typed text):
~[::
Input, UserInput, V T5 L4 C, {enter}.{esc}{tab}, btw,otoh,fl,ahk,ca
if ErrorLevel = Max
{
MsgBox, You entered "%UserInput%", which is the maximum length of text.
return
}
if ErrorLevel = Timeout
{
MsgBox, You entered "%UserInput%" at which time the input timed out.
return
}
if ErrorLevel = NewInput
return
IfInString, ErrorLevel, EndKey:
{
MsgBox, You entered "%UserInput%" and terminated the input with %ErrorLevel%.
return
}
; Otherwise, a match was found.
SetKeyDelay, -1 ; Most editors can handle the fastest speed.
if UserInput = btw
Send, {backspace 4}by the way
else if UserInput = otoh
Send, {backspace 5}on the other hand
else if UserInput = fl
Send, {backspace 3}Florida
else if UserInput = ca
Send, {backspace 3}California
else if UserInput = ahk
Run, www.autohotkey.com
return</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Send.htm" href="#Send.htm">#</a> <h2 class="calibre17">Send / SendRaw </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sends simulated keystrokes to the active window. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Send, Keys<br class="calibre12" /> SendRaw, Keys </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Keys</td>
<td width="85%" class="calibre4">The sequence of keys to send. The rate at which they are sent is determined by <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 x11">Please note that due to a bug in AHK_X11, certain special characters cannot be sent with this command natively. You will have to add a + in front of them to simulate a SHIFT key press. Example: Instead of `Send, Yes{!}` you will have to do `Send, Yes+{!}` or just use SendRaw instead.</p>
<p class="calibre8">SendRaw (available in v1.0.16+) sends the keystrokes in the <em class="calibre21">Keys</em> parameter exactly as they appear rather than translating {Enter} to an ENTER keystroke, ^c to Control-C, etc.<br class="calibre12" />
<br class="calibre12" /> The "Send" command syntax is similar to that of ScriptIt and the Visual Basic "SendKeys" command. Characters are sent as written with the exception of the following characters:<br class="calibre12" />
<br class="calibre12" />
<b class="calibre14">'!'</b><br class="calibre12" /> Sends an ALT keystroke, therefore <em class="calibre21">Send, This is text!a</em> would send the keys "This is text" and then press "ALT+a". <br class="calibre12" />
<br class="calibre12" /> N.B. Some programs are very choosy about capital letters and ALT keys, i.e. !A is different than !a. The first says ALT+SHIFT+A, the second is ALT+a. If in doubt, use lowercase!<br class="calibre12" />
<br class="calibre12" />
<b class="calibre14">'+'</b><br class="calibre12" /> Sends a SHIFT keystroke, therefore <em class="calibre21">Send, Hell+o</em>would send the text "HellO". <em class="calibre21">Send, !+a</em> would send "ALT+SHIFT+a".<br class="calibre12" />
<br class="calibre12" />
<b class="calibre14">'^'<br class="calibre12" />
</b>Sends a CONTROL keystroke, therefore <em class="calibre21">Send, ^!a</em> would send "CTRL+ALT+a".<br class="calibre12" />
<br class="calibre12" /> N.B. Some programs are very choosy about capital letters and CTRL keys, i.e. ^A is different than ^a. The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase!<br class="calibre12" />
<br class="calibre12" />
<b class="calibre14">'#'</b><br class="calibre12" /> Sends a WIN keystroke, therefore <em class="calibre21">Send, #a</em> would hold down the Windows key and then press the letter "a".<br class="calibre12" />
<br class="calibre12" />
<br class="calibre12" /> Certain special keys can be sent and should be enclosed in braces:<br class="calibre12" />
<br class="calibre12" />
<b class="calibre14"><u class="calibre20">N.B.  Windows does not allow the simulation of the "CTRL-ALT-DEL" combination!</u></b>
</p>
<table border="1" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="35%" class="calibre31"><b class="calibre14">Send Command</b></td>
<td width="65%" class="calibre4">
<p class="calibre35"><b class="calibre14">Resulting Keypress</b></p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{F1} - {F24}</td>
<td class="calibre4">Function keys. For example: {F12} is the F12 key.</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{!}</td>
<td width="65%" class="calibre4">!</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{#}</td>
<td width="65%" class="calibre4">#</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{+}</td>
<td width="65%" class="calibre4">+</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{^}</td>
<td width="65%" class="calibre4">^</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">&#123;&#123;&#125;</td>
<td width="65%" class="calibre4">&#123;</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">&#123;&#125;&#125;</td>
<td width="65%" class="calibre4">&#125;</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{ENTER}</td>
<td class="calibre4">ENTER key on the main keyboard</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{ESCAPE} or {ESC}</td>
<td class="calibre4">ESCAPE</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{SPACE}</td>
<td width="65%" class="calibre4">SPACE (this is only needed for spaces that appear either at the beginning or the end of the string to be sent -- ones in the middle can be literal spaces)</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{TAB}</td>
<td class="calibre4">TAB</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{BACKSPACE} or {BS}</td>
<td width="65%" class="calibre4">Backspace</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{DELETE} or {DEL}</td>
<td width="65%" class="calibre4">Delete</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{INSERT} or {INS}</td>
<td class="calibre4">Insert</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{UP}</td>
<td width="65%" class="calibre4">Cursor up key on main keyboard</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{DOWN}</td>
<td width="65%" class="calibre4">Cursor down key on main keyboard</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{LEFT}</td>
<td width="65%" class="calibre4">Cursor left key on main keyboard</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{RIGHT}</td>
<td width="65%" class="calibre4">Cursor right key on main keyboard</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{HOME}</td>
<td width="65%" class="calibre4">Home key on main keyboard</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{END}</td>
<td width="65%" class="calibre4">End key on main keyboard</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{PGUP}</td>
<td class="calibre4">Page up key on main keyboard</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{PGDN}</td>
<td class="calibre4">Page down key on main keyboard</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{CapsLock}</td>
<td class="calibre4">CapsLock (using <a href="#SetNumScrollCapsLockState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetCapsLockState</a> is more reliable on NT/2k/XP) </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{ScrollLock}</td>
<td class="calibre4">ScrollLock</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{NumLock}</td>
<td width="65%" class="calibre4">NumLock</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{CONTROL} or {CTRL} </td>
<td class="calibre4">CONTROL (sends the neutral virtual key but the left scan code)</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LCONTROL} or {LCTRL}</td>
<td class="calibre4">Left CONTROL key (same as CONTROL for Win9x, but on NT/2k/XP it sends the left virtual key rather than the neutral one) </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{RCONTROL} or {RCTRL}</td>
<td class="calibre4">Right CONTROL key</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{CONTROLDOWN} or {CtrlDown}</td>
<td class="calibre4">Holds the CONTROL key down until {CTRLUP} is sent. XP/2000/NT: To hold down the left or right key instead, use {RCtrl Down} and {RCtrl Up}. </td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{ALT}</td>
<td class="calibre4">ALT (sends the neutral virtual key but the left scan code)</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LALT}</td>
<td class="calibre4">Left ALT key (same as ALT for Win9x, but on NT/2k/XP it sends the left virtual key rather than the neutral one) </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{RALT}</td>
<td class="calibre4">Right ALT key</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{ALTDOWN}</td>
<td class="calibre4">Holds the ALT key down until {ALTUP} is sent. XP/2000/NT: To hold down the left or right key instead, use {RAlt Down} and {RAlt Up}.</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{SHIFT}</td>
<td class="calibre4"> SHIFT (sends the neutral virtual key but the left scan code)</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LSHIFT}</td>
<td class="calibre4">Left SHIFT key (same as SHIFT for Win9x, but on NT/2k/XP it sends the left virtual key rather than the neutral one) </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{RSHIFT}</td>
<td class="calibre4">Right SHIFT key</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{SHIFTDOWN}</td>
<td class="calibre4">Holds the SHIFT key down until {SHIFTUP} is sent. XP/2000/NT: To hold down the left or right key instead, use {RShift Down} and {RShift Up}.</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LWIN}</td>
<td class="calibre4">Left Windows key</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{RWIN}</td>
<td class="calibre4">Right Windows key</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LWINDOWN}</td>
<td class="calibre4">Holds the left Windows key down until {LWINUP} is sent</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{RWINDOWN}</td>
<td class="calibre4">Holds the right Windows key down until {RWINUP} is sent</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{APPSKEY}</td>
<td class="calibre4">Windows App key (invokes the right-click or context menu) </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{SLEEP}</td>
<td class="calibre4">Computer SLEEP key.</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{ASC nnnnn}</td>
<td class="calibre4">
<p class="calibre8"><a id="Send.htm__asc" href="#Send.htm__asc" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Sends an ALT+nnnnn keypad combination, which can be used to generate special characters that don't exist on the keyboard. To generate ASCII characters, specify a number between 1 and 255. To generate ANSI characters (standard in most languages), specify a number between 128 and 255, but precede it with a leading zero, e.g. {Asc 0133}.</p>
<p class="calibre8">In v1.0.13+, to generate Unicode characters, specify a number between 256 and 65535 (without a leading zero). You can also retrieve or store Unicode text on the clipboard via "<a href="#Transform.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Transform Unicode</a>".</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{vkXX} or {vkXXscYYY}</td>
<td class="calibre4"><a id="Send.htm__vk" href="#Send.htm__vk" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Sends a keystroke that has virtual key XX and scan code YYY. If the scYYY portion is omitted, XX's default scan code will sent. The values for XX and YYY are hexadecimal and can sometimes be determined from the main window's "View-&gt;Key history" menu item. Requires v1.0.14+. Example: Send {vkFFsc159}</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{Numpad0} - {Numpad9}</td>
<td width="65%" class="calibre4">Numpad digit keys (used when Numlock is ON). Example: {Numpad5} is the digit 5.</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadDot}</td>
<td class="calibre4">Numpad Period (used when Numlock is ON) </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadEnter}</td>
<td class="calibre4">Enter key on keypad</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{NumpadMult}</td>
<td width="65%" class="calibre4">Numpad Multiply</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadDiv}</td>
<td class="calibre4">Numpad Divide</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{NumpadAdd}</td>
<td width="65%" class="calibre4">Numpad Add</td>
</tr>
<tr class="calibre3">
<td width="35%" class="calibre31">{NumpadSub}</td>
<td width="65%" class="calibre4">Numpad Subtract</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadDel}</td>
<td class="calibre4">Delete key on keypad (this key and the following Numpad keys are used when Numlock is OFF)</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadIns}</td>
<td class="calibre4">Insert key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadClear}</td>
<td class="calibre4">Clear key on keypad (usually the '5' key). </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadUp}</td>
<td class="calibre4">Cursor up key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadDown}</td>
<td class="calibre4">Cursor down key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadLeft}</td>
<td class="calibre4">Cursor left key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadRight}</td>
<td class="calibre4">Cursor right key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadHome}</td>
<td class="calibre4">Home key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadEnd}</td>
<td class="calibre4">End key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadPgUp}</td>
<td class="calibre4">Page up key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{NumpadPgDn}</td>
<td class="calibre4">Page down key on keypad </td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{BROWSER_BACK}</td>
<td class="calibre4">2000/XP Only: Select the browser "back" button</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{BROWSER_FORWARD}</td>
<td class="calibre4">2000/XP Only: Select the browser "forward" button</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{BROWSER_REFRESH}</td>
<td class="calibre4">2000/XP Only: Select the browser "refresh" button</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{BROWSER_STOP}</td>
<td class="calibre4">2000/XP Only: Select the browser "stop" button</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{BROWSER_SEARCH}</td>
<td class="calibre4">2000/XP Only: Select the browser "search" button</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{BROWSER_FAVORITES}</td>
<td class="calibre4">2000/XP Only: Select the browser "favorites" button</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{BROWSER_HOME}</td>
<td class="calibre4">2000/XP Only: Launch the browser and go to the home page</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{VOLUME_MUTE}</td>
<td class="calibre4">2000/XP Only: Mute the volume</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{VOLUME_DOWN}</td>
<td class="calibre4">2000/XP Only: Reduce the volume</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{VOLUME_UP}</td>
<td class="calibre4">2000/XP Only: Increase the volume</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{MEDIA_NEXT}</td>
<td class="calibre4">2000/XP Only: Select next track in media player</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{MEDIA_PREV}</td>
<td class="calibre4">2000/XP Only: Select previous track in media player</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{MEDIA_STOP}</td>
<td class="calibre4">2000/XP Only: Stop media player</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{MEDIA_PLAY_PAUSE}</td>
<td class="calibre4">2000/XP Only: Play/pause media player</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LAUNCH_MAIL}</td>
<td class="calibre4">2000/XP Only: Launch the email application</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LAUNCH_MEDIA}</td>
<td class="calibre4">2000/XP Only: Launch media player</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LAUNCH_APP1}</td>
<td class="calibre4">2000/XP Only: Launch user app1</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LAUNCH_APP2}</td>
<td class="calibre4">2000/XP Only: Launch user app2</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{PRINTSCREEN}</td>
<td class="calibre4">PRINTSCR</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{CTRLBREAK}</td>
<td class="calibre4">Ctrl+break</td>
</tr>
<tr class="calibre3">
<td class="calibre31">{PAUSE}</td>
<td class="calibre4">PAUSE</td>
</tr>
<tr class="calibre3">
<td class="calibre31"> </td>
<td class="calibre4"> </td>
</tr>
<tr class="calibre3">
<td class="calibre31">{LButton}, {RButton}, {MButton}, {XButton1}, {XButton2}, {WheelDown}, {WheelUp}</td>
<td class="calibre4">These mouse button events will occur at the mouse cursor's current location. The delay between mouse clicks is determined by <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a> (not <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>). To have control over position and other options, use <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>. Requires v1.0.20. </td>
</tr>
</tbody>
</table>
<p class="calibre8"><br class="calibre12" /> In addition to the 26 English letters, the following letters and symbols are also supported (and possibly others too): €‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿<br class="calibre12" /> ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</p>
<p class="calibre8"><i class="calibre21">Single keys can also be repeated, e.g.<br class="calibre12" />
</i>    Send, {DEL 4}    Presses the DEL key 4 times<br class="calibre12" />     Send, {S 30}      Sends 30 'S' characters<br class="calibre12" />     Send, +{TAB 4}   Presses SHIFT+TAB 4 times</p>
<p class="calibre8"><em class="calibre21">Keys can also be held down or released, e.g.<br class="calibre12" />
</em>     Send, {B down}{B up}<br class="calibre12" />     Send, {TAB down}{TAB up}</p>
<p class="calibre8">The <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a> command can be used to prevent any keystrokes physically typed by the user from disrupting the flow of simulated keystrokes.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#SetStoreCapslockMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetStoreCapslockMode</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>, <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a>, <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotstrings</a>, <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">Send, Sincerely,{enter}John Smith</p>
<p class="calibre8">Send, !fs ; Select the File-&gt;Save menu (Alt+F followed by S).</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetKeyDelay.htm" href="#SetKeyDelay.htm">#</a> <h2 class="calibre17">SetKeyDelay</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the delay that will occur after each keystroke sent by <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> and <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetKeyDelay [, Delay, PressDuration] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Delay</td>
<td width="85%" class="calibre4">Time in milliseconds. Use -1 for no delay at all and 0 for the smallest possible delay. Leave this parameter blank to retain the current <em class="calibre21">Delay</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">PressDuration<br class="calibre12" /> </td>
<td class="calibre4">
<p class="calibre8">Certain games and other specialized applications may require a delay inside each keystroke; that is, after the press of the key but before its release.</p>
<p class="calibre8">Use -1 for no delay at all (default) and 0 for the smallest possible delay. Omit this parameter to leave the current <em class="calibre21">PressDuration </em>unchanged.</p>
<p class="calibre8">Note: <em class="calibre21">PressDuration</em> also produces a delay after any change to the modifier key state (CTRL, ALT, SHIFT, and WIN) needed to support the keys being sent.</p>
<p class="calibre8">This parameter exists only in v1.0.22+.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A short delay (sleep) is automatically and invisibly done after every keystroke sent by <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> or <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>. This is done to improve the reliability of scripts because a window sometimes can't keep up with a rapid flood of keystrokes.</p>
<p class="calibre8">Due to the granularity of the OS's time-keeping system, delays might be rounded up to the nearest multiple of 10. For example, a delay between 1 and 10 (inclusive) is equivalent to 10 on Windows XP (and probably NT &amp; 2k).</p>
<p class="calibre8">A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all. By contrast, a delay of -1 will never sleep. For better reliability, 0 is recommended as an alternative to -1.</p>
<p class="calibre8">If unset, the default delay is 10. The default <em class="calibre21">PressDuration</em> is -1.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_KeyDelay</strong> contains the current setting of <em class="calibre21">Delay. </em>There is no built-in variable for <em class="calibre21">PressDuration</em>.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetKeyDelay, 0</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetNumScrollCapsLockState.htm" href="#SetNumScrollCapsLockState.htm">#</a> <h2 class="calibre17">SetCapsLockState/SetNumLockState/SetScrollLockState</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the state of the Capslock/NumLock/ScrollLock key. Can also force the key to stay on or off.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">SetCapsLockState, State</p>
<p class="calibre8">SetNumLockState, State </p>
<p class="calibre8">SetScrollLockState, State </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">State</td>
<td width="85%" class="calibre4">
<p class="calibre8">On: Toggles the key into the "on" state. </p>
<p class="calibre8">Off: Toggles the key into the "off" state.</p>
<p class="calibre8">AlwaysOn: Forces the key to be always-on (not supported on Windows 9x). </p>
<p class="calibre8">AlwaysOff: Forces the key to be always-off (not supported on Windows 9x).</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Keeping a key <em class="calibre21">AlwaysOn</em> or <em class="calibre21">AlwaysOff</em> requires the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a>, which will be automatically installed in such cases.</p>
<p class="calibre8">These commands are currently not 100% reliable on Windows Me/98/95 due to the limitations of those OSes. As an alternative, a key can be reliably toggled to its opposite state via the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command. For example: Send, {Capslock} </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetStoreCapslockMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetStoreCapslockMode</a>, <a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetNumlockState, on<br class="calibre12" /> SetScrollLockState, AlwaysOff<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetStoreCapslockMode.htm" href="#SetStoreCapslockMode.htm">#</a> <h2 class="calibre17">SetStoreCapslockMode</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Whether to restore the state of CapsLock after a <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetStoreCapslockMode, On|Off</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">On|Off</td>
<td width="85%" class="calibre4">
<p class="calibre8">On: This is the initial setting for all scripts: The CapsLock key will be restored to its former value if <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> needed to change it temporarily for its operation. </p>
<p class="calibre8">Off: The state of the CapsLock key is not restored.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This setting is currently not reliable under Windows Me/98/95 due to the limitations of those OSes. This means that the Capslock key will not always be turned off for <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> and <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>. Even when it is successfully turned off, it might not get turned back on after the keys are sent.</p>
<p class="calibre8">This command is rarely used because the default behavior is best in most cases.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetNumScrollCapsLockState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetCaps/Num/ScrollLockState</a>, <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetStoreCapslockMode, off</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="EnvAdd.htm" href="#EnvAdd.htm">#</a> <h2 class="calibre17">EnvAdd</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to the sum of itself plus the given value (can also add or subtract time from a <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">date-time</a> value). Synonymous with: var += value</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">EnvAdd, Var, Value [, TimeUnits]<br class="calibre12" /> Var += Value [, TimeUnits]<br class="calibre12" /> Var++</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Var</td>
<td width="85%" class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to be operated upon.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Value</td>
<td class="calibre4">Any integer or floating point number.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">TimeUnits</td>
<td class="calibre4">
<p class="calibre8">If present, this parameter directs the command to add <em class="calibre21">Value</em> to <em class="calibre21">Var</em>, treating <em class="calibre21">Var</em> as a date-time stamp in the <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format and treating <em class="calibre21">Value</em> as the integer or floating point number of units to add (specify a negative number to perform subtraction). <em class="calibre21">TimeUnits</em> can be either Seconds, Minutes, Hours, or Days (or just the first letter of each of these).</p>
<p class="calibre8">If <em class="calibre21">Var</em> is an empty variable, the current time will be used in its place. If <em class="calibre21">Var</em> contains an invalid timestamp or a year prior to 1601, or if <em class="calibre21">Value</em> is non-numeric, <em class="calibre21">Var</em> will be made blank to indicate the problem.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_Now</strong> contains the current local time in <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to the shorthand style: Var += Value</p>
<p class="calibre8">Variables can be increased or decreased by 1 by using Var++, Var--, ++Var, or --Var.</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> is blank or does not start with a number, it is considered to be 0 for the purpose of the calculation (except when using <em class="calibre21">TimeUnits</em>, see above).</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> contains a decimal point, the end result will be a floating point number in the format set by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a>, <a href="#EnvMult.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvMult</a>, <a href="#EnvDiv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvDiv</a>, <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var is [not] type</a>, <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">EnvAdd, MyCount, 2<br class="calibre12" /> MyCount += 2 ; Equivalent to above</p>
<p class="calibre8">var1 = ; Make it blank so that the below will use the current time instead.<br class="calibre12" /> var1 += 31, days<br class="calibre12" /> MsgBox, %var1% ; The answer will be the date 31 days from now.</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="EnvDiv.htm" href="#EnvDiv.htm">#</a> <h2 class="calibre17">EnvDiv</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to itself divided by the given value. Synonymous with: var /= value</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">EnvDiv, Var, Value </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Var</td>
<td width="85%" class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to be operated upon.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Value</td>
<td class="calibre4">Any integer or floating point number (except zero).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to the shorthand style: Var /= Value</p>
<p class="calibre8">Division by zero will result in an error-message window when the script is loaded (if possible) or during runtime otherwise.</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> is blank or does not start with a number, it is considered to be 0 for the purpose of the calculation.</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> contains a decimal point, the end result will be a floating point number in the format set by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>. Otherwise, the result will be truncated (e.g. 19 divided by 10 will yield 1).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a><a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">, EnvSub</a>, <a href="#EnvMult.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvMult</a>, <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var is [not] type</a>, <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a>, <a href="#Transform.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">bitwise operations (Transform)</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">EnvDiv, MyCount, 2 </p>
<p class="calibre8">MyCount /= 2 ; Equivalent to above</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="EnvMult.htm" href="#EnvMult.htm">#</a> <h2 class="calibre17">EnvMult</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to itself times the given value. Synonymous with: var *= value</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">EnvMult, Var, Value </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Var</td>
<td width="85%" class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to be operated upon.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Value</td>
<td class="calibre4">Any integer or floating point number.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to the shorthand style: Var *= Value</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> is blank or does not start with a number, it is considered to be 0 for the purpose of the calculation.</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> contains a decimal point, the end result will be a floating point number in the format set by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a>, <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a>, <a href="#EnvDiv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvDiv</a>, <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var is [not] type</a>, <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a>, <a href="#Transform.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">bitwise operations (Transform)</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">EnvMult, MyCount, 2 </p>
<p class="calibre8">MyCount *= 2 ; Equivalent to above</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="EnvSub.htm" href="#EnvSub.htm">#</a> <h2 class="calibre17">EnvSub</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to itself minus the given value (can also compare <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">date-time</a> values). Synonymous with: var -= value</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">EnvSub, Var, Value [, TimeUnits]<br class="calibre12" /> Var -= Value [, TimeUnits] <br class="calibre12" /> Var-- </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Var</td>
<td width="85%" class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to be operated upon.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Value</td>
<td class="calibre4">Any integer or floating point number.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">TimeUnits</td>
<td class="calibre4">
<p class="calibre8">If present, this parameter directs the command to subtract <em class="calibre21">Value</em> from <em class="calibre21">Var</em> as though both of them are date-time stamps in the <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format. <em class="calibre21">TimeUnits</em> can be either Seconds, Minutes, Hours, or Days (or just the first letter of each of these). If <em class="calibre21">Value</em> is blank, the current time will be used in its place. Similarly, if <em class="calibre21">Var</em> is an empty variable, the current time will be used in its place.</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> is an invalid timestamp or contains a year prior to 1601, <em class="calibre21">Var</em> will be made blank to indicate the problem.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_Now</strong> contains the current local time in <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format.</p>
<p class="calibre8">To determine the elapsed time between two events that are only a few seconds or minutes apart, it is more precise (and often easier) to use A_TickCount as described <a href="#Variables.htm__TickCount" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">here</a>. <br class="calibre12" />
</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to the shorthand style: Var -= Value</p>
<p class="calibre8">Variables can be increased or decreased by 1 by using Var++, Var--, ++Var, or --Var.</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> is blank or does not start with a number, it is considered to be 0 for the purpose of the calculation (except when using <em class="calibre21">TimeUnits</em>; see above).</p>
<p class="calibre8">If either <em class="calibre21">Var</em> or <em class="calibre21">Value</em> contains a decimal point, the end result will be a floating point number in the format set by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a>, <a href="#EnvMult.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvMult</a>, <a href="#EnvDiv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvDiv</a>, <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If var is [not] type</a>, <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">EnvSub, MyCount, 2<br class="calibre12" /> MyCount -= 2 ; Equivalent to above</p>
<p class="calibre8">var1 = 20050126<br class="calibre12" /> var2 = 20040126<br class="calibre12" /> EnvSub, var1, %var2%, days<br class="calibre12" /> MsgBox, %var1% ; The answer will be 366 since 2004 is a leap year.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfEqual.htm" href="#IfEqual.htm">#</a> <h2 class="calibre17">If/IfEqual/IfNotEqual/IfLess/IfLessOrEqual/IfGreater/IfGreaterOrEqual</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Compares a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to a value for equality. Synonymous with: if var = value ... if var &lt;&gt; value</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IfEqual, var, value (same: if var = value)<span class=""><br class="calibre12" /> IfNotEqual, var, value (same: if var &lt;&gt; value) <span class="x11">(same: if var != value)</span><br class="calibre12" /> IfGreater, var, value (same: if var &gt; value)<br class="calibre12" /> IfGreaterOrEqual, var, value (same: if var &gt;= value)<br class="calibre12" /> IfLess, var, value (same: if var &lt; value) <br class="calibre12" /> IfLessOrEqual, var, value (same: if var &lt;= value)</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">var</td>
<td width="85%" class="calibre4">The <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> name. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">value</td>
<td class="calibre4">A literal string, number, or variable reference (e.g. %var2%). Value can be omitted if you wish to compare <em class="calibre21">var</em> to an empty string (blank). </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If both <em class="calibre21">var</em> and <em class="calibre21">value</em> are purely numeric, they will be compared as numbers rather than as strings. Otherwise, they will be compared alphabetically as strings (that is, alphabetical order will determine whether <em class="calibre21">var</em> is greater, equal, or less than <em class="calibre21">value</em>).</p>
<p class="calibre8">Another command can only appear on the same line as this one if you use the command-name style. In other words, this is valid: <br class="calibre12" /> IfEqual, x, 1, Sleep, 1<br class="calibre12" /> if x = 1 Sleep 1 ; But this is not.<br class="calibre12" /> IfGreater, x, 1, x += 2 ; Nor is this.<br class="calibre12" /> IfGreater, x, 1, EnvAdd, x, 2 ; But this is okay. </p>
<p class="calibre8">On a related note, The command "<a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var [not] between LowerBound and UpperBound</a>" checks whether a variable is between two values. Also, "<a href="#IfIn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var [not] in value1,value2</a>" can be used to check whether a variable's contents exist within a list of values. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfIn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var in/contains MatchList</a>, <a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var between</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">if counter = 1
Sleep, 1
if MyVar = Test String
Sleep, 1
if MyVar &lt;&gt; %MyVar2%
{
Sleep, 1
Exit
}
else
{
Sleep, 2
return
}</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfBetween.htm" href="#IfBetween.htm">#</a> <h2 class="calibre17"> If var [not] between LowerBound and UpperBound </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks whether a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable's</a> contents are numerically or alphabetically between two values (inclusive).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">if <em class="calibre21">Var</em> between <em class="calibre21">LowerBound</em> and <em class="calibre21">UpperBound</em> <br class="calibre12" /> if <em class="calibre21">Var</em> not between <em class="calibre21">LowerBound</em> and <em class="calibre21">UpperBound</em></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Var</td>
<td width="85%" class="calibre4">The <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> name whose contents will be checked.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">LowerBound</td>
<td class="calibre4">To be within the specified range, <em class="calibre21">Var</em> must be greater than or equal to this string, number, or variable reference.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">UpperBound</td>
<td class="calibre4">To be within the specified range, <em class="calibre21">Var</em> must be less than or equal to this string, number, or variable reference.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If all three of the parameters are purely numeric, they will be compared as numbers rather than as strings. Otherwise, they will be compared alphabetically as strings (that is, alphabetical order will determine whether <em class="calibre21">Var</em> is within the specified range). In that case, <em class="calibre21">"</em><a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><em class="calibre21">StringCaseSense</em></a><em class="calibre21"> On</em>" can be used to make the comparison case sensitive. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual/Greater/Less</a>, <a href="#IfIn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var in/contains MatchList</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var is type</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>, <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a><a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">, Blocks</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">if var between 1 and 5
MsgBox, %var% is in the range 1 to 5, inclusive.
if var not between 0.0 and 1.0
MsgBox %var% is not in the range 0.0 to 1.0, inclusive.
if var between blue and red
MsgBox %var% is alphabetically between blue and red.
LowerLimit = 1
UpperLimit = 10
InputBox, UserInput, Enter a number between %LowerLimit% and %UpperLimit%
if UserInput not between %LowerLimit% and %UpperLimit%
MsgBox Your input is not within the valid range.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="IfIs.htm" href="#IfIs.htm">#</a> <h2 class="calibre17"> If var is [not] type</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks whether a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable's</a> contents are numeric, uppercase, etc. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">if var is <em class="calibre21">type</em> <br class="calibre12" /> if var is not <em class="calibre21">type</em> </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">var</td>
<td width="85%" class="calibre4">The <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">type</td>
<td class="calibre4">See the remarks below. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Supported <em class="calibre21">Types</em>:</p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">integer</td>
<td width="85%" class="calibre4">True if <em class="calibre21">var</em> is non-empty and contains a purely numeric string without a decimal point. Leading and trailing whitespace is allowed. The string may start with a plus or minus sign. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">float</td>
<td class="calibre4">True if <em class="calibre21">var</em> is non-empty and contains a floating point number, that is, a purely numeric string containing a decimal point. Leading and trailing whitespace is allowed. The string may start with a plus sign, minus sign, or decimal point.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">number</td>
<td class="calibre4">True if <em class="calibre21">var</em> contains an integer or floating point number, as described above. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">digit</td>
<td class="calibre4">True if <em class="calibre21">var</em> is empty or contains only digits, which consist of the characters 0 through 9. Whitespace, plus signs, minus signs, and decimal points are not allowed.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">xdigit</td>
<td class="calibre4">Hexadecimal digit: Same as <em class="calibre21">digit</em> except the characters A through F (upper or lower case) are also allowed. Requires v1.0.14+. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">alpha</td>
<td class="calibre4">True if <em class="calibre21">var</em> is empty or contains only alphabetic characters. False if there are any digits, <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">whitespace</a>, punctuation, or other non-alphabetic characters anywhere in the string. For example, if <em class="calibre21">var</em> contains a space followed by a letter, it is not considered to be <em class="calibre21">alpha</em>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">upper</td>
<td class="calibre4">True if <em class="calibre21">var</em> is empty or contains only uppercase characters. False if there are any digits, <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">whitespace</a>, punctuation, or other non-uppercase characters anywhere in the string. Requires v1.0.14+.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">lower</td>
<td class="calibre4">True if <em class="calibre21">var</em> is empty or contains only lowercase characters. False if there are any digits, <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">whitespace</a>, punctuation, or other non-lowercase characters anywhere in the string. Requires v1.0.14+.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">alnum</td>
<td class="calibre4">Same as <em class="calibre21">alpha</em> except that <em class="calibre21">digit</em> characters are also allowed.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">space</td>
<td class="calibre4">True if <em class="calibre21">var</em> is empty or contains only <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">whitespace</a>, which consists of the following characters: space (<a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a>), tab (<a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Tab%</a> or `t), linefeed (`n), return (`r), vertical tab (`v), and formfeed (`f).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">time</td>
<td class="calibre4">
<p class="calibre8">True if <em class="calibre21">var</em> contains a valid date-time stamp, which can be all or just the leading part of the <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format. For example, a 4-digit string such as 2004 is considered valid. Use <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a> to determine whether additional time components are present.</p>
<p class="calibre8">Years less than 1601 are not considered valid because the operating system generally does not support them. The maximum year considered valid is 9999. </p>
<p class="calibre8">The word DATE may be used as a substitute for the word TIME, with the same result.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Variables.htm__YYYY" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_YYYY%</a>, <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a>, <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual</a>, <a href="#IfIn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var in/contains MatchList</a>, <a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var between</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a><a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">, Blocks</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">if var is float
MsgBox, %var% is a floating point number.
else if var is integer
MsgBox, %var% is an integer.
if var is time
MsgBox, %var% is also a valid date-time.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Random.htm" href="#Random.htm">#</a> <h2 class="calibre17">Random</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Generates a pseudo-random number.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Random, OutputVar [, Min, Max]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the result. The format of stored floating point numbers is determined by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Min</td>
<td width="85%" class="calibre4">The smallest number that can be generated (can be negative). If omitted, the smallest number will be 0. The lowest allowed value is -2147483648 for integers, but floating point numbers have no restrictions.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Max</td>
<td class="calibre4">The largest number that can be generated. If omitted, the largest number will be 2147483647 (which is also the largest allowed integer value -- but floating point numbers have no restrictions).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command creates a pseudo-randomly generated number, which is a number that simulates a true random number but is really a number based on a complicated formula to make determination/guessing of the next number extremely difficult.</p>
<p class="calibre8">If either <em class="calibre21">Min</em> or <em class="calibre21">Max</em> contains a decimal point, the end result will be a floating point number in the format set by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat.</a> Otherwise, the result will be an integer.</p>
<p class="calibre8" />
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> Random, rand, 1, 10<br class="calibre12" /> Random, rand, 0.0, 1.0<br class="calibre12" />
<br class="calibre12" />
</p>
<p class="calibre8">Comments based on the original source</p>
<p class="calibre8">This function uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura and Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada.</p>
<p class="calibre8">The Mersenne Twister is an algorithm for generating random numbers. It was designed with consideration of the flaws in various other generators. The period, 2<sup class="calibre36">19937</sup>-1, and the order of equidistribution, 623 dimensions, are far greater. The generator is also fast; it avoids multiplication and division, and it benefits from caches and pipelines. For more information see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html</p>
<p class="calibre8">Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved.</p>
<p class="calibre8">Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
<ol class="calibre19">
<li class="calibre11">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li class="calibre11">Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
<li class="calibre11">The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.</li>
</ol>
<p class="calibre8">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
<p class="calibre8">Do NOT use for CRYPTOGRAPHY without securely hashing several returned values together, otherwise the generator state can be learned after reading 624 consecutive values.</p>
<p class="calibre8">When you use this, send an email to: matumoto@math.keio.ac.jp with an appropriate reference to your work. It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu when you write.</p>
<p class="calibre8"><i class="calibre21">This above has been already been done for AutoHotkey, but if you use the Random command in a publicly distributed application, consider sending an e-mail to the above people to thank them for their efforts and generosity.</i></p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetFormat.htm" href="#SetFormat.htm">#</a> <h2 class="calibre17">SetFormat</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the format of integers and floating point numbers generated by math operations.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetFormat, NumberType, Format </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">
<p class="calibre8">NumberType</p>
</td>
<td width="85%" class="calibre4">
<p class="calibre8">Must be either INTEGER or FLOAT.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Format</td>
<td class="calibre4">
<p class="calibre8">For <em class="calibre21">NumberType</em> INTEGER, this parameter must be H or HEX for hexadecimal, or D for decimal. Hexadecimal numbers all start with the prefix 0x (e.g. 0xFF). </p>
<p class="calibre8">For <em class="calibre21">NumberType</em> FLOAT, this parameter is TotalWidth.DecimalPlaces (e.g. 0.6).</p>
<p class="calibre8"><em class="calibre21">TotalWidth</em> is typically 0 to indicate that number should not have any blank or zero padding. If a higher value is used, numbers <em class="calibre21" /> will be padded with spaces or zeroes (see below) to make them that wide.</p>
<p class="calibre8"><em class="calibre21">DecimalPlaces</em> is the number of decimal places to display (rounding will occur). If blank or zero, neither a decimal portion nor a decimal point will be displayed, that is, the number will be stored as an integer rather than a floating point number. </p>
<p class="calibre8">Padding: If <em class="calibre21">TotalWidth</em> is high enough to cause padding, spaces will be added on the left side, i.e. numbers will be right-justified. To use left-justification instead, precede <em class="calibre21">TotalWidth</em> with a minus sign. To pad with zeroes instead of spaces, precede <em class="calibre21">TotalWidth</em> with a zero.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If this command is not used in a script, integers default to decimal format and floating point numbers default to <em class="calibre21">TotalWidth.DecimalPlaces</em> = 0.6. Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8">You can determine whether a variable contains a numeric value by using "<a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var is number/integer/float</a>"</p>
<p class="calibre8">A variable containing a number can be forced into a new format (as set by this command) by adding zero to it, e.g. Var += 0 or Var += 0.0</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_FormatInteger</strong> contains the current integer format (H or D). <strong class="calibre14">A_FormatFloat</strong> contains the current floating point format.</p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20">Floating Point Format</u></p>
<p class="calibre8">Since AutoHotkey stores all variables as strings, the stored precision of floating point numbers is determined by <em class="calibre21">DecimalPlaces</em>. In other words, once a variable is rounded off, the extra precision is lost and cannot be reclaimed without redoing the calculation using a higher value of <em class="calibre21">DecimalPlaces</em>.</p>
<p class="calibre8">Any leading or trailing spaces (i.e. padding) in a floating point value will be lost if that value is explicitly assigned to another variable. Use <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a> to prevent this.</p>
<p class="calibre8">For the current float format to take effect in a math operation such as <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">addition</a>, at least one of the inputs must contain a decimal point.</p>
<p class="calibre8">A variable containing an integer can be "converted" into a floating point number by adding 0.0 to it, e.g. Var += 0.0. However, if the current float format specifies no <em class="calibre21">DecimalPlaces</em>, use this instead:<br class="calibre12" /> if Var is integer<br class="calibre12" />      Var = %Var%.0</p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20">Hexadecimal Format</u></p>
<p class="calibre8">Hexadecimal numbers all start with the prefix 0x (e.g. 0xA9). They can be used anywhere a numerical value is expected. For example, "Sleep, 0xFF" is equivalent to "Sleep, 255" regardless of the current integer format set by SetFormat.</p>
<p class="calibre8">To convert an integer from decimal to hexadecimal, use this example (the converse can be used to convert in the opposite direction):<br class="calibre12" /> SetFormat, integer, hex<br class="calibre12" /> VariableContainingAnInteger += 0<br class="calibre12" /> SetFormat, integer, d</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a>, <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a>, <a href="#EnvMult.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvMult</a>, <a href="#EnvDiv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvDiv</a>, <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var is type</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Var = 11.333333<br class="calibre12" /> SetFormat, float, 0.2<br class="calibre12" /> Var++ ; Sets Var to be 12.33</p>
<p class="calibre8">SetFormat, float, 06.0<br class="calibre12" /> Var += 0 ; Sets Var to be 000012</p>
<p class="calibre8">SetFormat, integer, hex<br class="calibre12" /> Var += 0 ; Sets Var to be 0xc</p>
<p class="calibre8">SetFormat, integer, d</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Transform.htm" href="#Transform.htm">#</a> <h2 class="calibre17">Transform</h2> [v1.0.11+]
<hr size="2" class="calibre24" />
<p class="calibre8">Performs miscellaneous math functions and tasks such as ASCII/Unicode conversion and bitwise operations.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Transform, OutputVar, Cmd, Value1 [, Value2]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the result of <em class="calibre21">Cmd</em>. <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a> determines whether integers are stored as hexadecimal or decimal.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Cmd, Value1/2</td>
<td width="85%" class="calibre4">See list below. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14"><u class="calibre20">Cmd, Value1, Value2 </u></strong></p>
<p class="calibre8">The <em class="calibre21">Cmd</em>, <em class="calibre21">Value1</em> and <em class="calibre21">Value2</em> parameters are dependent upon each other and their usage is described below.</p>
<p class="calibre8"><strong class="calibre14">Unicode [, String]</strong> [v1.0.24+]: Retrieves or stores Unicode text on the clipboard. There are two modes of operation as illustrated in the following examples:<br class="calibre12" /> Transform, OutputVar, Unicode ; Retrieves the clipboard's Unicode text as a UTF-8 string.<br class="calibre12" /> Transform, Clipboard, Unicode, %MyUTF_String% ; Places Unicode text onto the clipboard.</p>
<p class="calibre8">In the second example above, a literal UTF-8 string may be optionally used in place of %MyUTF_String%.</p>
<p class="calibre8">Use a hotkey such as the following to determine the UTF-8 string that corresponds to a given Unicode string:<br class="calibre12" /> ^!u:: ; Control+Alt+U<br class="calibre12" /> MsgBox Copy some Unicode text onto the clipboard, then return to this window and press OK to continue.<br class="calibre12" /> Transform, ClipUTF, Unicode<br class="calibre12" /> Clipboard = Transform, Clipboard, Unicode, %ClipUTF%`r`n<br class="calibre12" /> MsgBox The clipboard now contains the following line that you can paste into your script. When executed, this line will cause the original Unicode string you copied to be placed onto the clipboard:`n`n%Clipboard%<br class="calibre12" /> return</p>
<p class="calibre8">Windows 95 requires the <em class="calibre21">Microsoft Layer for Unicode</em> to support this command. Windows 98/Me/NT4 or later have built-in support. Also, the "<a href="#Send.htm__asc" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send {ASC nnnnn}</a>" command is an alternative way to produce Unicode characters. </p>
<p class="calibre8"><strong class="calibre14"><br class="calibre12" /> Asc, String</strong>: Retrieves the ASCII code (a number between 0 and 255) for the first character in <em class="calibre21">String</em>. If <em class="calibre21">String</em> is blank, <em class="calibre21">OutputVar</em> will also be made blank. Example: Transform, OutputVar, Asc, %VarContainingString%</p>
<p class="calibre8"><strong class="calibre14">Chr, Value1</strong>: Retrieves the single character corresponding to the ASCII code indicated by <em class="calibre21">Value1</em>. If <em class="calibre21">Value1</em> is not between 0 and 255 inclusive, <em class="calibre21">OutputVar</em> will be made blank to indicate the problem. Example: Transform, OutputVar, Chr, 130</p>
<p class="calibre8"><strong class="calibre14">Deref, String</strong> [v1.0.17+]: Expands variable references and <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape sequences</a> contained inside other variables. Any badly formatted variable references will be omitted from the expanded result. The same is true if <em class="calibre21">OutputVar</em> is expanded into itself; in other words, any references to <em class="calibre21">OutputVar</em> inside <em class="calibre21">String's</em> variables will be omitted from the expansion (note however that <em class="calibre21">String</em> itself can <u class="calibre20">be</u> %<em class="calibre21">OutputVar</em>%). In the following example, if var1 contains the string "test" and var2 contains the <u class="calibre20">literal</u> string "%var1%", <em class="calibre21">OutputVar</em> will be set to the string "test": Transform, OutputVar, deref, %var2%</p>
<p class="calibre8"><strong class="calibre14">HTML, String</strong> [v1.0.15+]: Converts <em class="calibre21">String</em> into its HTML equivalent by translating characters whose ASCII values are above 127 to their HTML names (e.g. £ becomes &amp;pound;). In addition, the four characters "&amp;&lt;&gt; are translated to &amp;quot;&amp;amp;&amp;lt;&amp;gt;. Finally, each linefeed (`n) is translated to &lt;br&gt;`n (i.e. &lt;br&gt; followed by a linefeed).</p>
<p class="calibre8"><strong class="calibre14">Mod, Dividend, Divisor</strong>: Retrieves the remainder of <em class="calibre21">Dividend</em> divided by <em class="calibre21">Divisor</em>. If Divisor is zero, <em class="calibre21">OutputVar</em> will be made blank. <em class="calibre21">Dividend</em> and <em class="calibre21">Divisor</em> can both contain a decimal point. If negative, <em class="calibre21">Divisor</em> will be treated as positive for the calculation. In the following example, the result is 2: Transform, OutputVar, mod, 5, 3</p>
<p class="calibre8"><strong class="calibre14">Pow, Value1, N </strong>: Retrieves <em class="calibre21">Value1</em> raised to the <em class="calibre21">N</em>th power. Both <em class="calibre21">Value1</em> and <em class="calibre21">N</em> may contain a decimal point. If <em class="calibre21">N</em> is negative, <em class="calibre21">OutputVar</em> will be formatted as a floating point number even if <em class="calibre21">Value1</em> and <em class="calibre21">N</em> are both integers. If <em class="calibre21">Value1 </em>is negative, <em class="calibre21">OutputVar</em> will be made blank, i.e. negatives are not supported.</p>
<p class="calibre8"><strong class="calibre14">Exp, N</strong>: Retrieves e (which is approximately 2.71828182845905) raised to the <em class="calibre21">N</em>th power. <em class="calibre21">N</em> may be negative and/or contain a decimal point.</p>
<p class="calibre8"><strong class="calibre14">Sqrt, Value1</strong>: Retrieves the square root of Value1. If <em class="calibre21">Value1</em> is negative, <em class="calibre21">OutputVar</em> will be made blank.</p>
<p class="calibre8"><strong class="calibre14">Log, Value1</strong>: Retrieves the logarithm (base 10) of <em class="calibre21">Value1</em>. If <em class="calibre21">Value1</em> is negative, <em class="calibre21">OutputVar</em> will be made blank.</p>
<p class="calibre8"><strong class="calibre14">Ln, Value1</strong>: Retrieves the natural logarithm (base e) of <em class="calibre21">Value1</em>. If <em class="calibre21">Value1</em> is negative, <em class="calibre21">OutputVar</em> will be made blank.</p>
<p class="calibre8"><strong class="calibre14">Round, Value1 [, N]</strong>: If <em class="calibre21">N</em> is omitted, <em class="calibre21">OutputVar</em> will be set to <em class="calibre21">Value1</em> rounded to the nearest integer. If <em class="calibre21">N</em> is positive number, <em class="calibre21">Value1</em> will be rounded to <em class="calibre21">N</em> decimal places. If <em class="calibre21">N</em> is negative, <em class="calibre21">Value1 </em>will be rounded by <em class="calibre21">N</em> digits to the left of the decimal point. For example, -1 rounds to the ones place, -2 rounds to the tens place, -3 rounds to the hundreds place, etc.</p>
<p class="calibre8"><strong class="calibre14">Ceil, Value1</strong>: Retrieves <em class="calibre21">Value1</em> rounded up to the nearest integer.</p>
<p class="calibre8"><strong class="calibre14">Floor, Value1</strong>: Retrieves <em class="calibre21">Value1</em> rounded down to the nearest integer.</p>
<p class="calibre8"><strong class="calibre14">Abs, Value1</strong>: Retrieves the absolute value of <em class="calibre21">Value1</em>, which is computed by removing the leading minus sign (dash) from <em class="calibre21">Value1</em> if it has one.</p>
<p class="calibre8"><strong class="calibre14">Sin, Value1</strong>: Retrieves the trigonometric sine of <em class="calibre21">Value1</em>. <em class="calibre21">Value1</em> must be expressed in radians.</p>
<p class="calibre8"><strong class="calibre14">Cos, Value1</strong>: Retrieves the trigonometric cosine of <em class="calibre21">Value1</em>. <em class="calibre21">Value1</em> must be expressed in radians. </p>
<p class="calibre8"><strong class="calibre14">Tan, Value1</strong>: Retrieves the trigonometric tangent of <em class="calibre21">Value1</em>. <em class="calibre21">Value1</em> must be expressed in radians.</p>
<p class="calibre8"><strong class="calibre14">ASin, Value1</strong>: Retrieves the arcsine (the number whose sine is <em class="calibre21">Value1</em>) in radians. If <em class="calibre21">Value1</em> is less than -1 or greater than 1, <em class="calibre21">OutputVar</em> will be made blank. </p>
<p class="calibre8"><strong class="calibre14">ACos, Value1</strong>: Retrieves the arccosine (the number whose cosine is <em class="calibre21">Value1</em>) in radians. If <em class="calibre21">Value1</em> is less than -1 or greater than 1, <em class="calibre21">OutputVar</em> will be made blank. </p>
<p class="calibre8"><strong class="calibre14">ATan, Value1</strong>: Retrieves the arctangent (the number whose tangent is <em class="calibre21">Value1</em>) in radians.</p>
<p class="calibre8"><strong class="calibre14">BitNot, Value1</strong>: Stores the bit-inverted version of <em class="calibre21">Value1</em> in <em class="calibre21">OutputVar</em>. If Value1 is between 0 and 4294967295 (0xffffffff), it will be treated as an <u class="calibre20">unsigned</u> 32-bit value. Otherwise, it is treated as a <u class="calibre20">signed</u> 64-bit value. In the following example, the result is 0xfffff0f0 (4294963440): Transform, OutputVar, BitNot, 0xf0f</p>
<p class="calibre8"><strong class="calibre14">BitAnd, Value1, Value2</strong>: Retrieves the result of the bitwise-AND of <em class="calibre21">Value1</em> and <em class="calibre21">Value2</em>. In the following example, the result is 0xff00 (65280): Transform, OutputVar, BitAnd, 0xff0f, 0xfff0</p>
<p class="calibre8"><strong class="calibre14">BitOr, Value1, Value2</strong>: Retrieves the result of the bitwise-OR of <em class="calibre21">Value1</em> and <em class="calibre21">Value2</em>. In the following example, the result is 0xf0f0 (61680): Transform, OutputVar, BitOr, 0xf000, 0x00f0</p>
<p class="calibre8"><strong class="calibre14">BitXOr, Value1, Value2</strong>: Retrieves the result of the bitwise-EXCLUSIVE-OR of <em class="calibre21">Value1</em> and <em class="calibre21">Value2</em>. In the following example, the result is 0xff00 (65280): Transform, OutputVar, BitXOr, 0xf00f, 0x0f0f</p>
<p class="calibre8"><strong class="calibre14">BitShiftLeft, Value1, Value2</strong>: Retrieves the result of shifting <em class="calibre21">Value1</em> to the left by <em class="calibre21">Value2</em> bit positions, which is equivalent to multiplying <em class="calibre21">Value1</em> by "2 to the <em class="calibre21">Value2</em>th power". In the following example, the result is 8: Transform, OutputVar, BitShiftLeft, 1, 3</p>
<p class="calibre8"><strong class="calibre14">BitShiftRight, Value1, Value2</strong>: Retrieves the result of shifting <em class="calibre21">Value1</em> to the right by <em class="calibre21">Value2</em> bit positions, which is equivalent to dividing <em class="calibre21">Value1</em> by "2 to the <em class="calibre21">Value2</em>th power" (truncating the remainder). In the following example, the result is 2: Transform, OutputVar, BitShiftRight, 17, 3</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If either <em class="calibre21">Value1 </em>or <em class="calibre21">Value2</em> is a floating point number, the following <em class="calibre21">Cmd</em>s will retrieve a floating point number rather than an integer: Mod, Pow, Round, and Abs. The number of decimal places retrieved is determined by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>.</p>
<p class="calibre8">To convert a radians value to degrees, multiply it by 180/pi (approximately 57.29578). To convert a degrees value to radians, multiply it by pi/180 (approximately 0.01745329252).</p>
<p class="calibre8">The value of pi (approximately 3.141592653589793) is 4 times the arctangent of 1.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>, <a href="#EnvMult.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvMult</a>, <a href="#EnvDiv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvDiv</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var is type</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Transform, OutputVar, Asc, A ; Get the ASCII code of the letter A.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_NoTrayIcon.htm" href="#h_NoTrayIcon.htm">#</a> <h2 class="calibre17">#NoTrayIcon</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Disables the showing of a tray icon.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#NoTrayIcon </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Specifying this anywhere in a script will prevent the showing of a tray icon for that script when it is launched (even if the script is compiled into an EXE).</p>
<p class="calibre8">If you use this for a script that has hotkeys, you might want to bind a hotkey to the <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> command. Otherwise, there will be no easy way to exit the program (without restarting the computer or killing the process). Example: #x::ExitApp</p>
<p class="calibre8">The tray icon can be made to disappear or reappear at any time during the execution of the script by using the command <em class="calibre21"><a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">menu</a>, tray, Icon</em> or <em class="calibre21"><a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">menu</a>, tray, NoIcon.</em> The only drawback of using the <em class="calibre21"><a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">menu</a>, tray, NoIcon </em>at the very top of the script is that the tray icon might be briefly visible when the script is first launched. To avoid that, use #NoTrayIcon instead.</p>
<p class="calibre8">In v1.0.13+, the built-in variable <strong class="calibre14">A_IconHidden</strong> contains 1 if the tray icon is currently hidden or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#NoTrayIcon</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="h_SingleInstance.htm" href="#h_SingleInstance.htm">#</a> <h2 class="calibre17">#SingleInstance</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Prevents more than one instance of a script from existing simultaneously.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#SingleInstance [force|ignore|off|prompt]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">force|ignore|off|prompt</td>
<td width="85%" class="calibre4">
<p class="calibre8">The word FORCE causes the program to skip the dialog box that is normally shown whenever a running script is launched a second time. Instead, the old instance will be automatically replaced, which is similar in effect to the <a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a> command. </p>
<p class="calibre8">The word IGNORE skips the dialog box as above, but leaves the old instance running. In other words, attempts to launch an already-running script are ignored.</p>
<p class="calibre8">The word OFF allows the running of multiple instances of a script. This is the default for scripts that are neither <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">persistent</a> nor contain <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a>.</p>
<p class="calibre8 x11">The word PROMPT asks the user on what to do. This is the default for scripts that are persistent or contain Hotkeys etc.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#SingleInstance force<br class="calibre12" /> #SingleInstance ignore<br class="calibre12" /> #SingleInstance off </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="AutoTrim.htm" href="#AutoTrim.htm">#</a> <h2 class="calibre17">AutoTrim</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Determines whether <a href="#SetEnv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetEnv and "var = value"</a> statements remove spaces and tabs.</p>
<p style="color: #005500 !important;text-decoration:none !important;">Currently always OFF.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">AutoTrim, On|Off </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">On|Off</td>
<td width="85%" class="calibre4">
<p class="calibre8">On: tabs and spaces at the beginning and end of a string are removed from a variable whenever it is assigned a new value. This is the default. </p>
<p class="calibre8">Off: tabs and spaces are not removed.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If this command is not used by a script, the setting defaults to ON.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_AutoTrim</strong> contains the current setting (On or Off).</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8">The <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a> and <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Tab%</a> built-in variables contain a single space and single tab character, respectively. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> AutoTrim, off<br class="calibre12" /> NewVar1 = %OldVar% ; If OldVar contains leading and trailing spaces, NewVar will have them too.<br class="calibre12" /> NewVar2 = %A_Space% ; With AutoTrim off, a single space can be assigned this way.</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="CoordMode.htm" href="#CoordMode.htm">#</a> <h2 class="calibre17">CoordMode</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets coordinate mode for various commands to be either relative or screen.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">CoordMode, ToolTip|Pixel|Mouse [, Screen|Relative]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Param1</td>
<td width="85%" class="calibre4">
<p class="calibre8"><strong class="calibre14">ToolTip</strong>: Affects <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a>.</p>
<p class="calibre8"><strong class="calibre14">Pixel</strong>: Affects <a href="#PixelGetColor.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelGetColor</a> and <a href="#PixelSearch.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelSearch</a>.</p>
<p class="calibre8"><strong class="calibre14">Mouse</strong>: Affects <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>, and <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>.</p>
<p class="calibre8"><strong class="calibre14">Caret</strong>: Affects the built-in variables <a href="#Variables.htm__Caret" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_CaretX</a> and <a href="#Variables.htm__Caret" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_CaretY</a>.</p>
<p class="calibre8"><strong class="calibre14">Menu</strong>: Affects the "<a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a> Show" command when coordinates are specified for it.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Param2</td>
<td class="calibre4">
<p class="calibre8"><strong class="calibre14">Screen</strong> (this is the default when omitted): Coordinates are relative to the desktop (entire screen).</p>
<p class="calibre8"><strong class="calibre14">Relative</strong>: Coordinates are relative to the active window.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If this command isn't used, all commands except those documented otherwise (e.g. <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a> and <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>) use coordinates that are relative to the active window. </p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>, <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>, <a href="#PixelGetColor.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelGetColor</a>, <a href="#PixelSearch.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelSearch</a>, <a href="#ToolTip.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ToolTip</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">; Place ToolTips at absolute screen coordinates:<br class="calibre12" /> CoordMode, ToolTip, Screen</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Edit.htm" href="#Edit.htm">#</a> <h2 class="calibre17">Edit</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Opens the current script for editing in the associated editor.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> This command opens the current script for editing (using the associated "edit" verb, or Notepad if no verb), or activates an existing Editor window if it finds one it thinks may have the file open based on its window title. It is equivalent to selecting "Edit This Script" from the tray menu.</p>
<p class="calibre8">This command has no effect when operating from within a compiled script.</p>
<p class="calibre8">On a related note, the Extras folder included with AutoHotkey has some add-ons for editors such as TextPad. In addition, context sensitive help for AutoHotkey commands can be enabled in any editor via <a href="#ContextSensitiveHelp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">this example</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Reload.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Reload</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Edit ; opens the script for editing. </p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ListLines.htm" href="#ListLines.htm">#</a> <h2 class="calibre17">ListLines</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays the script lines most recently executed.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ListLines</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to selecting the "View-&gt;Lines most recently executed" menu item in the main window.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>, <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a>, <a href="#ListVars.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListVars</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">ListLines</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ListVars.htm" href="#ListVars.htm">#</a> <h2 class="calibre17">ListVars</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Displays the script's <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variables:</a> their names and current contents.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ListVars </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to selecting the "View-&gt;Variables" menu item in the main window.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>, <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a>, <a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">ListVars</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain x11">
<div class="calibreEbookContent">
<a id="EnvGet.htm" href="#EnvGet.htm">#</a> <h2 class="calibre17">EnvGet</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves an environment variable.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">EnvGet, OutputVar, EnvVarName </td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Menu.htm" href="#Menu.htm">#</a> <h2 class="calibre17">Menu</h2> [v1.0.07+]
<hr size="2" class="calibre24" />
<table cellspacing="5" width="100%" class="calibre28">
<p class="calibre8">Creates, <span class="tbd">deletes, modifies</span> and displays menus and menu items. Changes the tray icon and its tooltip. <span class="tbd">Controls whether the main window of a compiled script can be opened.</span></p>
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Menu, MenuName, Cmd [, P3, P4, P5, FutureUse]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">MenuName</td>
<td width="85%" class="calibre4">
<p class="calibre8">This parameter must be the word TRAY since that is the only supported menu. <span class="tbd">In v1.0.13+, it can be TRAY or the name of any custom menu. A custom menu is automatically created the first time its name is used with the <em class="calibre21">Add</em> command. Example: Menu, MyMenu, Add, Item1</span></p>
<p class="calibre8"><span class="tbd">Once created, a custom menu can be displayed with the <em class="calibre21">Show</em> command. It can also be attached as a submenu to one or more other menus via the <em class="calibre21">Add</em> command.</span>
</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Cmd, P3, P4, P5 </td>
<td class="calibre4">These 4 parameters are dependent on each other. See list below for the allowed combinations. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">FutureUse</td>
<td class="calibre4">This parameter should always be omitted.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<div class="calibre17">
<p class="calibre8"><u class="calibre20">Change the Items in a Menu</u></p>
</div>
<p class="calibre8"><strong class="calibre14">Add [, MenuItemName, Label<span class="tbd">-or-Submenu</span>, Pn]</strong>: This is a multipurpose command that adds a menu item, <span class="tbd">updates one with a new submenu or label, or converts one from a normal item into a submenu (or vice versa).</span> If <em class="calibre21">MenuItemName</em> doesn't yet exist, it will be added. <span class="tbd">Otherwise<em class="calibre21">, MenuItemName</em> is updated with the newly specified <em class="calibre21">Label-or-Submenu</em>.</span></p>
<p class="calibre8">To add a menu separator line, omit both parameters. If only <em class="calibre21">Label-or-Submenu</em> is omitted, <em class="calibre21">MenuItemName</em> will be used as both the label and the menu item's name. The label subroutine is run as a new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> when the user selects the menu item (similar to <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a> and <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey subroutines</a>).</p>
<p class="calibre8"><span class="tbd">To have <em class="calibre21">MenuItemName</em> become a submenu -- which is a menu item that opens a new menu when selected -- specify for <em class="calibre21">Label-or-Submenu</em> a colon followed by the <em class="calibre21">MenuName</em> of an existing custom menu. Example:<br class="calibre12" /> Menu, MySubmenu, add, Item1<br class="calibre12" /> Menu, tray, add, This Menu Item Is A Submenu, :MySubmenu</span></p>
<p class="calibre8">The <em class="calibre21">Pn</em> parameter specifies for <strong class="calibre14">n</strong> the menu's <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread priority</a>, e.g. p1. If omitted when adding a menu item, the priority will be 0. If omitted when <span class="tbd">updating a menu item, the item's priority will not be changed. To change an existing item's priority only, omit the <em class="calibre21">Label-or-Submenu</em> parameter.</span> Use a decimal (not hexadecimal) number for <strong class="calibre14">n</strong>. <br class="calibre12" />
<br class="calibre12" />
<span class="tbd"><strong class="calibre14">Delete [, MenuItemName</strong>]: Deletes <em class="calibre21">MenuItemName</em> from the menu. Standard menu items (see below) cannot be individually deleted. If the <em class="calibre21">d</em><em class="calibre21">efault</em> menu item is deleted, the effect will be similar to having used the <em class="calibre21">NoDefault</em> option. If <em class="calibre21">MenuItemName</em> is omitted, the entire <em class="calibre21">MenuName</em> menu will be deleted as will any menu items in other menus that use <em class="calibre21">MenuName</em> as a submenu.</span>
</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">DeleteAll</strong>: Deletes all custom menu items from the menu, leaving the menu empty unless it contains the <em class="calibre21">standard</em> items (see below). Unlike a menu entirely deleted by the <em class="calibre21">Delete</em> command (see above), an empty menu still exists and thus any other menus that use it as a submenu will retain those submenus.</p>
<p class="calibre8"><strong class="calibre14">Rename, MenuItemName [, NewName]</strong> [v1.0.08+]: Changes <em class="calibre21">MenuItemName</em> to <em class="calibre21">NewName </em>(if <em class="calibre21">NewName</em> is blank, <em class="calibre21">MenuItemName</em> will be converted into a separator line). <em class="calibre21">NewName</em> must not be the same as any existing custom menu item. The menu item's current target label or submenu is unchanged.</p>
<p class="calibre8"><strong class="calibre14">Check, MenuItemName</strong>: Adds a visible checkmark in the menu next to <em class="calibre21">MenuItemName</em> (if there isn't one already).</p>
<p class="calibre8"><strong class="calibre14">Uncheck, MenuItemName</strong>: Removes the checkmark from <em class="calibre21">MenuItemName</em> if there is one.</p>
<p class="calibre8"><strong class="calibre14">ToggleCheck, MenuItemName</strong>: Adds a checkmark if there wasn't one; otherwise, removes it.</p>
<p class="calibre8"><strong class="calibre14">Enable, MenuItemName</strong>: Allows the user to once again select <em class="calibre21">MenuItemName</em> if was previously disabled (grayed).</p>
<p class="calibre8"><strong class="calibre14">Disable, MenuItemName</strong>: Changes <em class="calibre21">MenuItemName </em>to a gray color to indicate that the user cannot select it.</p>
<p class="calibre8"><strong class="calibre14">ToggleEnable, MenuItemName</strong>: Disables <em class="calibre21">MenuItemName</em> if it was previously enabled; otherwise, enables it.</p>
<p class="calibre8"><strong class="calibre14">Default [, MenuItemName]</strong>: Changes the menu's default item to be <em class="calibre21">MenuItemName</em> and makes that item's font bold (setting a default item in menus other than the tray currently has no other function). When the user double-clicks the tray icon, its default menu item is launched. If there is no default, double-clicking has no effect. If <em class="calibre21">MenuItemName</em> is omitted, the effect is the same as having used <em class="calibre21">NoDefault</em> below.</p>
<p class="calibre8"><strong class="calibre14">NoDefault</strong>: For the tray menu: Changes the menu back to having its standard default menu item, which is OPEN for non-compiled scripts and none for <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">compiled scripts</a> (except when the <em class="calibre21">MainWindow</em> option is in effect). If the OPEN menu item does not exist due to a previous use of the NoStandard command below, there will be no default and thus double-clicking the tray icon will have no effect. For menus other than the tray: Any existing default item is returned to a non-bold font. </p>
<p class="calibre8"><strong class="calibre14">Standard</strong>: Inserts the standard menu items at the bottom of the menu (if they are not already present). This command can be used with the tray menu or any other menu.</p>
<p class="calibre8"><strong class="calibre14">NoStandard</strong>: Removes all standard (non-custom) menu items from the tray menu (if they are present).</p>
</div>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20"><span class="calibre17">Change the Icon or ToolTip</span></u> (<em class="calibre21">MenuName</em> must be TRAY)</p>
<p class="calibre8"><strong class="calibre14">Icon, FileName [, IconNumber]</strong> [v1.0.13+]: Changes the script's icon to one of the ones from <em class="calibre21">FileName</em> (<span class="rm">a .ico, .dll, or .exe file</span> <span class="x11">an image file such as .png or .gif. .jpg does not seem to work.</span>). <span class="rm">If <em class="calibre21">IconNumber</em> is omitted, it defaults to 1 (the first icon in the file)</span>. Specify an asterisk (*) for <em class="calibre21">FileName</em> to restore the script to its default icon. This setting affects the tray icon and the one displayed by <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>, and <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI</a> windows. <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Compiled scripts</a> are also affected even if a custom icon was specified at the time of compiling. Note: Changing the icon will not unhide the tray icon if it was previously hidden by means such as <a href="#h_NoTrayIcon.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#NoTrayIcon</a>; to do that, use "Menu, Tray, Icon" as described below. Also, the built-in variables <strong class="calibre14"><span class="rm">A_IconNumber</span></strong> and <strong class="calibre14">A_IconFile</strong> contain the number and name (with full path) of the current icon (both are blank if the icon is the default).</p>
<p class="calibre8"><span class="tbd"><strong class="calibre14">Icon </strong>(with no parameters) [v1.0.09+]: Creates the tray icon if it isn't already present. This will override <a href="#h_NoTrayIcon.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#NoTrayIcon</a> if that directive is also present in the script.</span></p>
<p class="calibre8"><strong class="calibre14">NoIcon</strong><strong class="calibre14"> </strong>Removes the tray icon if it exists. If this command is used at the very top of the script, the tray icon might be briefly visible when the script is launched. To prevent that, use <a href="#h_NoTrayIcon.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#NoTrayIcon</a> instead. <span class="tbd">In v1.0.13+, the built-in variable <strong class="calibre14">A_IconHidden</strong> contains 1 if the tray icon is currently hidden or 0 otherwise.</span></p>
<p class="calibre8"><strong class="calibre14">Tip [, Text] </strong>[v1.0.13+]: Changes the tray icon's tooltip -- which is displayed when the mouse hovers over it -- to be <em class="calibre21">Text</em>. To create a multi-line tooltip, use the linefeed character (`n) in between each line, e.g. Line1`nLine2. If <em class="calibre21">Text</em> is omitted, the tooltip is restored to its default text. The built-in variable <strong class="calibre14">A_IconTip</strong> contains the current text of the tooltip (blank if the text is at its default).</p>
<p class="calibre8"> </p>
<div class="tbd">
<p class="calibre8"><span class="calibre17"><u class="calibre20">Misc.</u></span></p>
<p class="calibre8"><strong class="calibre14">Show [, X, Y] </strong> [v1.0.13+]: Displays <em class="calibre21">MenuName</em>, allowing the user to select an item with arrow keys, menu shortcuts (underlined letters), or the mouse. Any menu can be shown, including the tray menu but with the exception of <a href="#GUI.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI</a> menu bars. If both X and Y are omitted, the menu is displayed at the current position of the mouse cursor. If only one of them is omitted, the mouse cursor's position will be used for it. X and Y are relative to the active window. Specify "<a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, Menu" beforehand to make them relative to the entire screen. [X and Y require v1.0.23+].</p>
<p class="calibre8"><strong class="calibre14">Color, ColorValue [, Single]</strong> [v1.0.19+]: Changes the background color of the menu to <em class="calibre21">ColorValue</em>, which is one of the 16 primary HTML color names or a 6-digit RGB color value (see <a href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">color chart</a>). Leave <em class="calibre21">ColorValue</em> blank (or specify the word Default) to restore the menu to its default color. If the word Single is not present as the next parameter, any submenus attached to this menu will also be changed in color. This command has no effect on Windows 95/NT.</p>
<p class="calibre8"><strong class="calibre14">Click, ClickCount</strong> [v1.0.24+]: Specify 1 for <em class="calibre21">ClickCount</em> to allow a single-click to activate the tray menu's default menu item. Specify 2 for <em class="calibre21">ClickCount</em> to return to the default behavior (double-click). Example: Menu, Tray, Click, 1 </p>
<p class="calibre8"><strong class="calibre14">MainWindow</strong><strong class="calibre14"> </strong>[v1.0.09+]: This command affects <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">compiled scripts</a> only. It allows the script's main window to be opened via the tray icon, which is otherwise impossible. It also enables the items in the main window's View menu -- such as "Lines most recently executed" -- allowing users to view the script's source code and other info. <em class="calibre21">MenuName</em> must be TRAY. </p>
<p class="calibre8"><strong class="calibre14">NoMainWindow </strong>[v1.0.09+] (default): This command affects <a href="#Scripts.htm__ahk2exe" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">compiled scripts</a> only. It restores the script to its default behavior, that is, it prevents the main window from being opened. Even while this option is in effect, the following commands are still able to show the main window when they are encountered in the script at runtime: <a href="#ListLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListLines</a>, <a href="#ListVars.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListVars</a>, <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a>, and <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a>. <em class="calibre21">MenuName</em> must be TRAY.</p>
<p class="calibre8"><strong class="calibre14">UseErrorLevel [, off]</strong> [v1.0.13+]: If this option is never used in the script, it defaults to OFF. The OFF setting displays a dialog and terminates the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> whenever the Menu command generates an error. Specify <em class="calibre21">Menu, AnyMenuName, UseErrorLevel</em> to prevent the dialog and thread termination; instead, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to 1 if there was a problem or 0 otherwise. To turn this option back off, specify OFF for the next parameter. This setting is global, meaning it affects all menus, not just <em class="calibre21">MenuName</em>.</p>
</div>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><u class="calibre20">Remarks</u></span></p>
<div class="tbd">
<p class="calibre8">To underline one of the letters in <em class="calibre21">a </em>menu item's name, precede that letter with an ampersand (&amp;). When the menu is displayed, such menu items can be selected by pressing the corresponding key on the keyboard. To display a literal ampersand, specify two consecutive ampersands as in this example: Save &amp;&amp; Exit</p>
<p class="calibre8">The names of menus and menu items can be up to 260 characters long.</p>
<p class="calibre8">When referring to an existing menu or menu item, the name is not case sensitive but you must include any ampersands it contains. Example: &amp;Notepad </p>
</div>
<p class="calibre8">Separator lines can be added to the menu by using <em class="calibre21">Menu, tray, add</em> (i.e. omit all other parameters). However, separator lines currently cannot be individually deleted. To work around this, use <em class="calibre21">Menu, tray, DeleteAll </em>and then re-add your custom menu items. </p>
<p class="calibre8">Custom menu items are always added at the bottom of the menu. For the tray menu: To put your menu items on top of the standard menu items (after adding your own menu items) run <em class="calibre21">Menu, tray, NoStandard</em> followed by <em class="calibre21">Menu, tray, Standard</em>.</p>
<p class="calibre8">If a menu ever becomes completely empty -- such as by using <em class="calibre21">Menu, MyMenu, DeleteAll </em> -- it cannot be shown. If the tray menu becomes empty, right-clicking and double-clicking the tray icon will have no effect.</p>
<p class="calibre8">If a menu item's subroutine is already running and the user selects the same menu item again, a new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> will be created to run that same subroutine, interrupting the previous thread.</p>
<p class="calibre8">Whenever a subroutine is launched via a menu item, it starts off fresh with the default values for settings such as <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>. These defaults can be changed in the <a href="#Scripts.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">auto-execute section</a>.</p>
<div class="tbd">
<p class="calibre8">In v1.0.13+, the built-in variable <strong class="calibre14"><a href="#Variables.htm__ThisMenuItem" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ThisMenuItem</a></strong> and <strong class="calibre14"><a href="#Variables.htm__ThisMenuItemPos" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ThisMenuItemPos</a> </strong>contain the name and position of the custom menu item most recently selected by the user (blank if none). Similarly, <strong class="calibre14">A_ThisMenu</strong> is the name of the menu from which <strong class="calibre14">A_ThisMenuItem</strong> was selected. These variables are useful when building a menu whose contents are not always the same. In such a case, it is usually best to point all such menu items to the same label and have it refer to the above variables to determine what action to take.</p>
</div>
<p class="calibre8">To keep a non-hotkey script running -- such as one that contains only custom menus or menu items -- use <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a>.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GUI</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#Thread.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Thread</a>, <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a>, <a href="#Return.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a>, <a href="#h_Persistent.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Persistent</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">Menu, tray, add, Item1, MenuHandler
return
MenuHandler:
MsgBox You selected %A_ThisMenuItem% from menu %A_ThisMenu%
return
; This next example is a working script to demonstrate some of the various menu commands.
#Persistent
#SingleInstance
menu, tray, add ; separator
menu, tray, add, TestToggle&amp;Check
menu, tray, add, TestToggleEnable
menu, tray, add, TestDefault
menu, tray, add, TestStandard
menu, tray, add, TestDelete
menu, tray, add, TestDeleteAll
menu, tray, add, TestRename
menu, tray, add, Test
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TestToggle&amp;Check:
menu, tray, ToggleCheck, TestToggle&amp;Check
menu, tray, Enable, TestToggleEnable ; Also enables the next test since it can't undo the disabling of itself.
menu, tray, add, TestDelete ; Similar to above.
return
TestToggleEnable:
menu, tray, ToggleEnable, TestToggleEnable
return
TestDefault:
if default = TestDefault
{
menu, tray, NoDefault
default =
}
else
{
menu, tray, Default, TestDefault
default = TestDefault
}
return
TestStandard:
if standard &lt;&gt; n
{
menu, tray, NoStandard
standard = n
}
else
{
menu, tray, Standard
standard = y
}
return
TestDelete:
menu, tray, delete, TestDelete
return
TestDeleteAll:
menu, tray, DeleteAll
return
TestRename:
if NewName &lt;&gt; renamed
{
OldName = TestRename
NewName = renamed
}
else
{
OldName = renamed
NewName = TestRename
}
menu, tray, rename, %OldName%, %NewName%
return
Test:
MsgBox, You selected "%A_ThisMenuItem%" in menu "%A_ThisMenu%".
return
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="PixelGetColor.htm" href="#PixelGetColor.htm">#</a> <h2 class="calibre17">PixelGetColor </h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the color of the pixel at the specified x,y screen coordinates.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">PixelGetColor, OutputVar, X, Y [, RGB] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the color ID in hexadecimal blue-green-red (BGR) format. For example, the color purple is defined 0x800080 because it has an 80 intensity for its blue and red components but a 00 intensity for its green component. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">X,Y</td>
<td class="calibre4">The X and Y coordinates of the pixel. Coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change that.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">RGB</td>
<td class="calibre4">If this parameter is the word RGB, the color will be retrieved in RGB vs. BGR format. In other words, the red and the blue components are swapped. This is useful for retrieving colors compatible with <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet, </a><a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a>, <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Progress</a>, and <a href="#Progress.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashImage</a>.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The pixel must be visible; in other words, it is not possible to retrieve the pixel color of a window hidden behind another window.</p>
<p class="calibre8">Use Window Spy (available in tray icon menu) or the example below to determine the colors currently on the screen.<br class="calibre12" />
</p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#PixelSearch.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelSearch</a>, <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">^!z::<br class="calibre12" /> MouseGetPos, MouseX, MouseY<br class="calibre12" /> PixelGetColor, color, %MouseX%, %MouseY%<br class="calibre12" /> MsgBox, The color at the current cursor position is %color%.<br class="calibre12" /> return</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="PixelSearch.htm" href="#PixelSearch.htm">#</a> <h2 class="calibre17">PixelSearch</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Searches a region of the screen for a pixel of the specified color(s).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">PixelSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ColorID [, Variation, RGB]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVarX/Y</td>
<td width="85%" class="calibre4">The names of the variables in which to store the X and Y coordinates of the first pixel that matches <em class="calibre21">ColorID</em>. Either or both of these may be omitted (i.e. if you're just interested in the value of <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> set by the command).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X1,Y1</td>
<td class="calibre4">The X and Y coordinates of the upper left corner of the rectangle to search. Coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change that.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X2,Y2</td>
<td class="calibre4">The X and Y coordinates of the lower right corner of the rectangle to search. Coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change that.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ColorID</td>
<td class="calibre4">The decimal or hexadecimal color ID to search for, in Blue-Green-Red (BGR) format. Color IDs can be determined using Window Spy (accessible from the tray menu) or via <a href="#PixelGetColor.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelGetColor</a>. Example: 0x9d6346</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Variation</td>
<td class="calibre4"> A number between 0 and 255 (inclusive) to indicate the allowed number of shades of variation in either direction for the intensity of the red, green, and blue components of the color. This can be helpful if the color you're looking for isn't always exactly the same shade. If you specify 255 shades of variation, all colors will match. The default is 0 shades.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">RGB</td>
<td class="calibre4">If this parameter is the word RGB, ColorID is assumed to be in RGB vs. BGR format. In other words, the red and the blue components are swapped.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0 if the color was found in the specified region, 1 if it was not found, or 2 if there was a problem that prevented the command from conducting the search.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The region to be searched must be visible; in other words, it is not possible to search a region of a window hidden behind another window.</p>
<p class="calibre8">If the region to be searched is large and the search is repeated with high frequency, it may consume a lot of CPU time. To alleviate this, keep the size of the area to a minimum.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#PixelGetColor.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelGetColor</a>, <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">PixelSearch, Px, Py, 200, 200, 300, 300, 16777215, 3
if ErrorLevel = 0
MsgBox, A color within 3 shades of variation was found at X%Px% Y%Py%.
else
MsgBox, That color was not found in the specified region.
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="SetEnv.htm" href="#SetEnv.htm">#</a> <h2 class="calibre17">SetEnv</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Assigns the specified value to a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>. Synonymous with: var = value</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">SetEnv, Var, Value</p>
<p class="calibre8">Var = Value </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Var</td>
<td width="85%" class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> in which to store <em class="calibre21">Value</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Value</td>
<td class="calibre4">The string or number to store. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"><span class="rm">The name "SetEnv" is misleading and is used only for backward compatibility with AutoIt2: Unlike AutoIt2, AutoHotkey does not store its variables in the environment. This is because performance would be worse and also because the OS limits such variables to 32K (AutoHotkey variables, including the <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard</a>, are essentially unlimited in size). Use <a href="#EnvSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSet</a> instead of SetEnv to write to an <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable</a>.</span></p>
<p class="calibre8">The memory occupied by a large variable can be freed by setting it equal to nothing, e.g. var =</p>
<p class="calibre8">It is possible to create an <a href="#Arrays.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">array</a> with this command and any others that accept an <em class="calibre21">OutputVar</em>. This is done by making <em class="calibre21">OuputVar</em> contain a reference to another variable, e.g. array%i% = 123. See <a href="#Arrays.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Arrays</a> for more info.</p>
<p class="calibre8"> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#EnvSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSet</a>, <a href="#EnvAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvAdd</a>, <a href="#EnvSub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSub</a>, <a href="#EnvMult.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvMult</a>, <a href="#EnvDiv.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvDiv</a>, <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">If</a>, <a href="#Arrays.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Arrays</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Var1 = This is a string.<br class="calibre12" /> Color2 = 450<br class="calibre12" /> Color3 = %Var1%<br class="calibre12" /> Array%i% = %A_TICKCOUNT%</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SysGet.htm" href="#SysGet.htm">#</a> <h2 class="calibre17">SysGet</h2> [v1.0.22+]
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves screen resolution, multi-monitor info, dimensions of system objects, and other system properties.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SysGet, OutputVar, Sub-command [, Param3]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the result.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Sub-command</td>
<td class="calibre4">See list below. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Param3</td>
<td class="calibre4">This parameter is omitted except where noted below.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Sub-commands</strong></p>
<p class="calibre8"><strong class="calibre14">MonitorCount</strong>: Retrieves the total number of monitors. Unlike SM_CMONITORS mentioned in the table below, <em class="calibre21">MonitorCount </em>includes all monitors, even those not being used as part of the desktop. On Windows 95/NT the count is always 1.</p>
<p class="calibre8"><strong class="calibre14">MonitorPrimary</strong>: Retrieves the number of the primary monitor, which will be 1 in a single-monitor system. On Windows 95/NT the primary monitor is always 1.</p>
<p class="calibre8"><strong class="calibre14">Monitor [, N] </strong>: Retrieves the bounding coordinates of monitor number <strong class="calibre14">N</strong> (if <strong class="calibre14">N</strong> is omitted, the primary monitor is used). The information is stored in four variables whose names all start with <em class="calibre21">OutputVar</em>. If <strong class="calibre14">N</strong> is too high or there is a problem retrieving the info, the variables are all made blank. Example:<br class="calibre12" /> SysGet, Mon2, Monitor, 2 <br class="calibre12" /> MsgBox, Left: %Mon2Left% -- Top: %Mon2Top% -- Right: %Mon2Right% -- Bottom %Mon2Bottom%.</p>
<p class="calibre8"><strong class="calibre14">MonitorWorkArea [, N]</strong>: Same as the above except the area is reduced to exclude the area occupied by the taskbar and other registered desktop toolbars.</p>
<p class="calibre8"><strong class="calibre14">MonitorName [, N]</strong>: The operating system's name for monitor number <strong class="calibre14">N</strong> (if <strong class="calibre14">N</strong> is omitted, the primary monitor is used).</p>
<p class="calibre8"><strong class="calibre14">(Numeric)</strong>: Specify for <em class="calibre21">Sub-command</em> one of the numbers from the table below to retrieve the corresponding value. The following example would store the number of mouse buttons in a variable named "MouseButtonCount":<br class="calibre12" /> SysGet, MouseButtonCount, 43</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17">Commonly Used</span></p>
<table border="1" bordercolor="#c0c0c0" cellpadding="3" cellspacing="0" class="calibre37">
<tbody class="calibre2">
<tr class="calibre38">
<th class="calibre39">Number</th>
<th class="calibre39">Description</th>
</tr>
<tr class="calibre3">
<td class="calibre4">80</td>
<td class="calibre4"> SM_CMONITORS: Number of display monitors on the desktop (not including "non-display pseudo-monitors"). <b class="calibre14">Windows 95/NT:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">43</td>
<td class="calibre4">SM_CMOUSEBUTTONS: Number of buttons on mouse (0 if no mouse is installed).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">16, 17 </td>
<td class="calibre4">SM_CXFULLSCREEN, SM_CYFULLSCREEN: Width and height of the client area for a full-screen window on the primary display monitor, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">61, 62 </td>
<td class="calibre4">SM_CXMAXIMIZED, SM_CYMAXIMIZED: Default dimensions, in pixels, of a maximized top-level window on the primary display monitor.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">59, 60 </td>
<td class="calibre4">SM_CXMAXTRACK, SM_CYMAXTRACK: Default maximum dimensions of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">28, 29 </td>
<td class="calibre4">SM_CXMIN, SM_CYMIN: Minimum width and height of a window, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">57, 58 </td>
<td class="calibre4">SM_CXMINIMIZED, SM_CYMINIMIZED: Dimensions of a minimized window, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">34, 35 </td>
<td class="calibre4">SM_CXMINTRACK, SM_CYMINTRACK: Minimum tracking width and height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions. A window can override these values by processing the <a href="/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_getminmaxinfo.asp" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WM_GETMINMAXINFO</a> message.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0, 1 </td>
<td class="calibre4">SM_CXSCREEN, SM_CYSCREEN: Width and height of the screen of the primary display monitor, in pixels. These are the same as the built-in variables <a href="#Variables.htm__Screen" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScreenWidth</a> and <a href="#Variables.htm__Screen" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScreenHeight</a>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">78, 79 </td>
<td class="calibre4">SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN: Width and height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors. The SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN metrics are the coordinates of the top-left corner of the virtual screen. <b class="calibre14">Windows NT, Windows 95:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">19</td>
<td class="calibre4">SM_MOUSEPRESENT: Nonzero if a mouse is installed; zero otherwise.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">75</td>
<td class="calibre4">SM_MOUSEWHEELPRESENT: Nonzero if a mouse with a wheel is installed; zero otherwise. <b class="calibre14">Windows 95:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">63</td>
<td class="calibre4">SM_NETWORK: Least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">8193</td>
<td class="calibre4"> SM_REMOTECONTROL: This system metric is used in a Terminal Services environment. Its value is nonzero if the current session is remotely controlled; zero otherwise. <b class="calibre14">Windows 2000/NT, Windows Me/98/95:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">4096</td>
<td class="calibre4"> SM_REMOTESESSION: This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is nonzero. If the calling process is associated with the Terminal Server console session, the return value is zero. The console session is not necessarily the physical console. <b class="calibre14">Windows NT 4.0 SP3 and earlier, Windows Me/98/95:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">70</td>
<td class="calibre4"> SM_SHOWSOUNDS: Nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; zero otherwise. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">8192</td>
<td class="calibre4"> SM_SHUTTINGDOWN: Nonzero if the current session is shutting down; zero otherwise. <b class="calibre14">Windows 2000/NT, Windows Me/98/95:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">23</td>
<td class="calibre4">SM_SWAPBUTTON: Nonzero if the meanings of the left and right mouse buttons are swapped; zero otherwise.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">76, 77 </td>
<td class="calibre4"> SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN: Coordinates for the left side and the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. By contrast, the SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN metrics (further above) are the width and height of the virtual screen. <b class="calibre14">Windows NT, Windows 95:  </b>The retrieved value is always 0.</td>
</tr>
</tbody>
</table>
<p class="calibre8"><span class="calibre17">Not Commonly Used</span></p>
<table border="1" bordercolor="#c0c0c0" cellpadding="3" cellspacing="0" class="calibre37">
<tbody class="calibre2">
<tr class="calibre38">
<th class="calibre39">Number</th>
<th class="calibre39">Description</th>
</tr>
<tr class="calibre3">
<td class="calibre4">56</td>
<td class="calibre4">SM_ARRANGE: Flags specifying how the system arranged minimized windows. See MSDN for more information.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">67</td>
<td class="calibre4"> SM_CLEANBOOT: Specifies how the system was started:<br class="calibre12" /> 0 Normal boot<br class="calibre12" /> 1 Fail-safe boot<br class="calibre12" /> 2 Fail-safe with network boot</td>
</tr>
<tr class="calibre3">
<td class="calibre4">5, 6 </td>
<td class="calibre4"> SM_CXBORDER, SM_CYBORDER: Width and height of a window border, in pixels. This is equivalent to the SM_CXEDGE value for windows with the 3-D look. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">13, 14 </td>
<td class="calibre4">SM_CXCURSOR, SM_CYCURSOR: Width and height of a cursor, in pixels. The system cannot create cursors of other sizes.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">36, 37 </td>
<td class="calibre4"> SM_CXDOUBLECLK, SM_CYDOUBLECLK: Width and height of the rectangle around the location of a first click in a double-click sequence, in pixels. The second click must occur within this rectangle for the system to consider the two clicks a double-click. (The two clicks must also occur within a specified time.)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">68, 69 </td>
<td class="calibre4">SM_CXDRAG, SM_CYDRAG: Width and height of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins. These values are in pixels. It allows the user to click and release the mouse button easily without unintentionally starting a drag operation.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">45, 46 </td>
<td class="calibre4">SM_CXEDGE, SM_CYEDGE: Dimensions of a 3-D border, in pixels. These are the 3-D counterparts of SM_CXBORDER and SM_CYBORDER.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">7, 8 </td>
<td class="calibre4">SM_CXFIXEDFRAME, SM_CYFIXEDFRAME (synonymous with SM_CXDLGFRAME, SM_CYDLGFRAME): Thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels. SM_CXFIXEDFRAME is the height of the horizontal border and SM_CYFIXEDFRAME is the width of the vertical border.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">83, 84 </td>
<td class="calibre4">SM_CXFOCUSBORDER, SM_CYFOCUSBORDER: Width (in pixels) of the left and right edges and the height of the top and bottom edges of a control's focus rectangle. <b class="calibre14">Windows 2000/NT, Windows Me/98/95:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">21, 22 </td>
<td class="calibre4">SM_CXHSCROLL, SM_CYHSCROLL: Width of the arrow bitmap on a horizontal scroll bar, in pixels; and height of a horizontal scroll bar, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">10</td>
<td class="calibre4">SM_CXHTHUMB: Width of the thumb box in a horizontal scroll bar, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">11, 12 </td>
<td class="calibre4">SM_CXICON, SM_CYICON: Default width and height of an icon, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">38, 39 </td>
<td class="calibre4">SM_CXICONSPACING, SM_CYICONSPACING: Dimensions of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged. These values are always greater than or equal to SM_CXICON and SM_CYICON.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">71, 72 </td>
<td class="calibre4">SM_CXMENUCHECK, SM_CYMENUCHECK: Dimensions of the default menu check-mark bitmap, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">54, 55 </td>
<td class="calibre4">SM_CXMENUSIZE, SM_CYMENUSIZE: Dimensions of menu bar buttons, such as the child window close button used in the multiple document interface, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">47, 48 </td>
<td class="calibre4">SM_CXMINSPACING SM_CYMINSPACING: Dimensions of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged. These values are always greater than or equal to SM_CXMINIMIZED and SM_CYMINIMIZED.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">29, 30 </td>
<td class="calibre4">SM_CXSIZE, SM_CYSIZE: Width and height of a button in a window's caption or title bar, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">32, 33 </td>
<td class="calibre4">SM_CXSIZEFRAME, SM_CYSIZEFRAME: Thickness of the sizing border around the perimeter of a window that can be resized, in pixels. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border. Synonymous with SM_CXFRAME and SM_CYFRAME.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">49, 50 </td>
<td class="calibre4">SM_CXSMICON, SM_CYSMICON: Recommended dimensions of a small icon, in pixels. Small icons typically appear in window captions and in small icon view.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">52, 53 </td>
<td class="calibre4">SM_CXSMSIZE SM_CYSMSIZE: Dimensions of small caption buttons, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2, 20 </td>
<td class="calibre4">SM_CXVSCROLL, SM_CYVSCROLL: Width of a vertical scroll bar, in pixels; and height of the arrow bitmap on a vertical scroll bar, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">4</td>
<td class="calibre4">SM_CYCAPTION: Height of a caption area, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">18</td>
<td class="calibre4">SM_CYKANJIWINDOW: For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">15</td>
<td class="calibre4">SM_CYMENU: Height of a single-line menu bar, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">51</td>
<td class="calibre4">SM_CYSMCAPTION: Height of a small caption, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">9</td>
<td class="calibre4">SM_CYVTHUMB: Height of the thumb box in a vertical scroll bar, in pixels.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">42</td>
<td class="calibre4"> SM_DBCSENABLED: Nonzero if User32.dll supports DBCS; zero otherwise. <b class="calibre14">Windows Me/98/95:  </b>Nonzero if the double-byte character-set (DBCS) version of User.exe is installed; zero otherwise.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">22</td>
<td class="calibre4">SM_DEBUG: Nonzero if the debug version of User.exe is installed; zero otherwise.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">82</td>
<td class="calibre4"> SM_IMMENABLED: Nonzero if Input Method Manager/Input Method Editor features are enabled; zero otherwise. <b class="calibre14">Windows NT, Windows Me/98/95:  </b>The retrieved value is always 0. <p class="calibre8"> SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application. To ensure that a language-dependent IME works, check SM_DBCSENABLED and the system ANSI code page. Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts or registry setting may not be present. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">87</td>
<td class="calibre4">SM_MEDIACENTER: Nonzero if the current operating system is the Windows XP, Media Center Edition, zero if not.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">40</td>
<td class="calibre4">SM_MENUDROPALIGNMENT: Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; zero if the menus are left-aligned.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">74</td>
<td class="calibre4">SM_MIDEASTENABLED: Nonzero if the system is enabled for Hebrew and Arabic languages, zero if not.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">41</td>
<td class="calibre4">SM_PENWINDOWS: Nonzero if the Microsoft Windows for Pen computing extensions are installed; zero otherwise.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">44</td>
<td class="calibre4">SM_SECURE: Nonzero if security is present; zero otherwise.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">81</td>
<td class="calibre4"> SM_SAMEDISPLAYFORMAT: Nonzero if all the display monitors have the same color format, zero otherwise. Note that two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel's color value. <b class="calibre14">Windows NT, Windows 95:  </b>The retrieved value is always 0.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">73</td>
<td class="calibre4">SM_SLOWMACHINE: Nonzero if the computer has a low-end (slow) processor; zero otherwise.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">86</td>
<td class="calibre4">SM_TABLETPC: Nonzero if the current operating system is the Windows XP Tablet PC edition, zero if not.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The built-in variables <a href="#Variables.htm__Screen" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScreenWidth</a> and <a href="#Variables.htm__Screen" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_ScreenHeight</a> contain the dimensions of the primary monitor, in pixels.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">Example #1:
SysGet, MouseButtonCount, 43
SysGet, VirtualScreenWidth, 78
SysGet, VirtualScreenHeight, 79
Example #2: This is a working script that displays info about each monitor:
SysGet, MonitorCount, MonitorCount
SysGet, MonitorPrimary, MonitorPrimary
MsgBox, Monitor Count:`t%MonitorCount%`nPrimary Monitor:`t%MonitorPrimary%
Loop, %MonitorCount%
{
SysGet, MonitorName, MonitorName, %A_Index%
SysGet, Monitor, Monitor, %A_Index%
SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
MsgBox, Monitor:`t#%A_Index%`nName:`t%MonitorName%`nLeft:`t%MonitorLeft% (%MonitorWorkAreaLeft% work)`nTop:`t%MonitorTop% (%MonitorWorkAreaTop% work)`nRight:`t%MonitorRight% (%MonitorWorkAreaRight% work)`nBottom:`t%MonitorBottom% (%MonitorWorkAreaBottom% work)
}
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Thread.htm" href="#Thread.htm">#</a> <h2 class="calibre17">Thread</h2> [v1.0.16+]
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the priority or interruptibility of the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Thread, Setting, P2 [, P3]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> See list below. <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14"><u class="calibre20">Setting, P2, P3 </u></strong></p>
<p class="calibre8">The <em class="calibre21">Setting, P2, and P3 </em>parameters are dependent upon each other and their usage is described below.</p>
<p class="calibre8"><strong class="calibre14">Priority, n</strong>: Specify for <strong class="calibre14">n</strong> an integer between -2147483648 and 2147483647 to indicate the current thread's new priority. This has no effect on other threads. See <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a> for details.</p>
<p class="calibre8">On a related note, the OS's priority level for the entire script can be changed as in this example: <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><em class="calibre21">Process</em></a><em class="calibre21">, priority,, high</em></p>
<p class="calibre8"><strong class="calibre14">Interrupt, Duration [, LineCount]</strong>: By default, every newly launched thread is uninterruptible for a <em class="calibre21">Duration</em> of 15 milliseconds or a <em class="calibre21">LineCount</em> of 1000 script lines, whichever comes first. This gives the thread a chance to finish rather than being immediately interrupted by another thread that is waiting to launch (such as a buffered <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> or a series of <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed subroutines</a> that are all due to be run).</p>
<p class="calibre8">If either component is 0, each newly launched thread is immediately interruptible. If either component is -1, the thread cannot be interrupted as a result of that component.</p>
<p class="calibre8">The Interrupt setting is global, meaning that all subsequent threads will obey it, even if the setting is changed somewhere other than the <a href="#Scripts.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">auto-execute section</a>. However,<a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> interrupted threads</a> are unaffected because their period of uninterrutibility has already expired. Similarly, the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> is unaffected except if it is uninterruptible at the time the <em class="calibre21">LineCount</em> component is changed, in which case the new <em class="calibre21">LineCount</em> will be in effect for it.</p>
<p class="calibre8">If a <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> is pressed or a <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a> is selected while the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> is uninterruptible, that event will be buffered. In other words, it will launch when the current thread finishes or becomes interruptible, whichever comes first. The exception to this is when the current thread becomes interruptible before it finishes, and it is of higher priority than the buffered event; in this case the buffered event is unbuffered and discarded.</p>
<p class="calibre8">Regardless of this setting, a thread will become interruptible the moment it displays a <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, or <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a> dialog. </p>
<p class="calibre8">Either parameter can be left blank to avoid changing it.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command should be used sparingly because most scripts perform more consistently with settings close to the defaults.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a>, <a href="#Hotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Thread, priority, 1 ; Make priority of current thread slightly above average.</p>
<p class="calibre8">Thread, interrupt, 50, 2000</p>
<p class="calibre8">; Make each newly launched thread immediately interruptible:<br class="calibre12" /> Thread, interrupt, 0</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="URLDownloadToFile.htm" href="#URLDownloadToFile.htm">#</a> <h2 class="calibre17">URLDownloadToFile</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Downloads a file from the Internet.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">URLDownloadToFile, URL, Filename </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">URL</td>
<td width="85%" class="calibre4">URL of the file to download. For example, http://someorg.org might retrieve the welcome page for that organization. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Filename</td>
<td class="calibre4">Name of the file to be created locally, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified. Any existing file will be <strong class="calibre14">overwritten</strong> by the new file. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The download might appear to succeed even when the remote file doesn't exist. This is because many web servers send an error page instead of the missing file. This error page is what will be saved in place of <em class="calibre21">Filename</em>.</p>
<p class="calibre8 rm">Due to the nature of this command, there might be some keyboard or mouse lag (reduced responsiveness) during the download if the script executing it has the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> and/or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hooks installed. This limitation will be resolved in a future release, if possible.</p>
<p class="calibre8 rm">Internet Explorer 3 or greater must be installed for this function to work. Firewalls or the presence of multiple network adapters may cause this function to fail. Also, some websites may block such downloads.</p>
<p class="calibre8 rm">The file is obtained from IE cache whenever possible. You might be able to force a (re)download from the Internet by supplying a fake cgi parameter, for example: <em class="calibre21">"http://.../test.exe?fakeParam=42" </em></p>
<p class="calibre8 rm">Remember that backslash (\) is used within <em class="calibre21">Filename, </em>in contrast to <em class="calibre21">URL</em>, which uses forward-slash (/).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#FileCopy.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileCopy</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">URLDownloadToFile, http://www.someorg.org, /tmp/SomeOrg's Welcome.htm</p>
<p class="calibre8">URLDownloadToFile, http://someorg.org/archive.zip, /tmp/SomeOrg's Archive.zip</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ControlClick.htm" href="#ControlClick.htm">#</a> <h2 class="calibre17">ControlClick</h2>
<hr size="2" class="calibre24" />
<p class="calibre8"><span class="rm">Sends a mouse button or mouse wheel event to</span><span class="x11"> Interacts with</span> a control. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlClick, Control<span class="rm">-or-Pos</span> [, WinTitle, WinText, <span class="rm">WhichButton</span>, ClickCount, <span class="rm">Options</span>, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Control-or-Pos</td>
<td width="85%" class="calibre4">
<p class="calibre8 tbd">If this parameter is blank or omitted, the target window's topmost control will be used. Otherwise, one of the two modes below will be used.</p>
<p class="calibre8 rm">Mode 1 (Position): In v1.0.24+, this parameter may optionally specify X and Y coordinates relative to the target window's upper left corner. The X coordinate must precede the Y coordinate and there must be at least one space or tab between them. Example: X55 Y33. If there is a control at the specified coordinates, it will be sent the click-event at those exact coordinates. If there is no control, the target window itself will be sent the event (which might have no effect depending on the nature of the window). Note: In this mode, the X and Y option letters of the <em class="calibre21">Options</em> parameter are ignored.</p>
<p class="calibre8">Mode 2 (ClassNN or Text): Specify either ClassNN (the classname and instance number of the control <span class="x11">(recommended)</span>) or the name/text of the control <span class="x11">(can be slow)</span>, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>.</p>
<p class="calibre8 rm">By default, mode 2 takes precedence over mode 1. For example, in the unlikely event that there is a control whose text or ClassNN has the format "Xnnn Ynnn", it would be acted upon by Mode 2. To override this and use mode 1 unconditionally, specify the word Pos in Options as in the following example: ControlClick, x255 y152, WinTitle,,,, Pos</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3 rm">
<td class="calibre4">WhichButton</td>
<td class="calibre4">
<p class="calibre8">The button to click: LEFT, RIGHT, MIDDLE, or (in v1.0.09+) just the first letter of each of these. If omitted or blank, the LEFT button will be used.</p>
<p class="calibre8">WheelUp (or WU) and WheelDown (or WD) are also supported. In this case, <em class="calibre21">ClickCount</em> is the number of notches to turn the wheel.</p>
<p class="calibre8">X1 (XButton1, the 4th mouse button) and X2 (XButton2, the 5th mouse button) are also supported.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ClickCount</td>
<td class="calibre4">The number of clicks to send. If omitted or blank, 1 click is sent. </td>
</tr>
<tr class="calibre3 rm">
<td class="calibre4">Options</td>
<td class="calibre4">
<p class="calibre8">A series of zero or more of the following option letters. Example: d x50 y25</p>
<p class="calibre8"><strong class="calibre14">D</strong>: Press the mouse button down but do not release it (i.e. generate a down-event). If both the <strong class="calibre14">D</strong> and <strong class="calibre14">U</strong> options are absent, a complete click (down and up) will be sent.</p>
<p class="calibre8"><strong class="calibre14">U</strong>: Release the mouse button (i.e. generate an up-event). This option should not be present if the <strong class="calibre14">D</strong> option is already present (and vice versa).</p>
<p class="calibre8"><strong class="calibre14">Pos</strong>: Specify the word Pos anywhere in <em class="calibre21">Options</em> to unconditionally use the X/Y positioning mode as described in the <em class="calibre21">Control-or-Pos</em> parameter above. </p>
<p class="calibre8"><strong class="calibre14">Xn</strong>: Specify for <strong class="calibre14">n</strong> the X position to click at, relative to the control's upper left corner. If unspecified, the click will occur at the horizontal-center of the control. [Requires v1.0.16+]</p>
<p class="calibre8"><strong class="calibre14">Yn</strong>: Specify for <strong class="calibre14">n </strong> the Y position to click at, relative to the control's upper left corner. If unspecified, the click will occur at the vertical-center of the control. [Requires v1.0.16+]</p>
<p class="calibre8">Use decimal (not hexadecimal) numbers for the <strong class="calibre14">X</strong> and <strong class="calibre14">Y</strong> options. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="x11">This command relies on accessibility support. <a href="#Accessibility.htm">Please read this section</a> to avoid problems.</p>
<p class="calibre8 x11">Button- or position related options are not supported because control interactions are based on atspi accessible actions, not specific buttons. This command always tries to find the action that best resembles a "Click" and executes it. If you encounter an application where ControlClick doesn't work as expected, this may be a bug - please consider opening an issue at <a href="https://github.com/phil294/ahk_x11">https://github.com/phil294/ahk_x11</a>.</p>
<p class="calibre8 rm">Not all applications obey a <em class="calibre21">ClickCount</em> higher than 1 for turning the mouse wheel. For those applications, use a Loop to turn the wheel more than one notch as in this example, which turns it 5 notches:<br class="calibre12 rm" /> Loop, 5<br class="calibre12" />      ControlClick, <em class="calibre21 rm">Control</em>, <em class="calibre21">WinTitle</em>, <em class="calibre21 rm">WinText</em>, WheelUp</p>
<p class="calibre8" />
<p class="calibre8 rm">To improve reliability, a short delay is done automatically after every use of this command. That delay can be changed via <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8"> ControlClick, OK, Some Window Title ; Clicks the OK button</p>
<p class="calibre8"> ControlClick, push_button_0_1_1, Some Window Title ; Clicks the OK button based on its ClassNN which is usually faster</p>
<p class="calibre8 rm">ControlClick, x55 y77, WinTitle ; Clicks at a set of coordinates. Note the lack of a comma between X and Y.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="MouseClick.htm" href="#MouseClick.htm">#</a> <h2 class="calibre17">MouseClick</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Clicks or holds a mouse button, or turns the mouse wheel.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">MouseClick, WhichButton [, X, Y, ClickCount, <span class="tbd">Speed</span>, D|U, R]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">WhichButton</td>
<td class="calibre4">
<p class="calibre8">The button to click: LEFT, RIGHT, or MIDDLE, or just the first letter of each of these.</p>
<p class="calibre8">WheelUp (or WU) and WheelDown (or WU) are also supported on Windows NT/2000/XP+. In this case, <em class="calibre21">ClickCount</em> is the number of notches to turn the wheel.</p>
<p class="calibre8">X1 (XButton1, the 4th mouse button) and X2 (XButton2, the 5th mouse button) are also supported. For example: MouseClick, X1 </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X, Y </td>
<td class="calibre4">The x/y coordinates to move the mouse to, prior to clicking. Coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change that. If omitted, the current position is used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ClickCount</td>
<td class="calibre4">The number of times to click the mouse.  If omitted, the button is clicked once. </td>
</tr>
<tr class="calibre3 tbd">
<td width="15%" class="calibre4">Speed</td>
<td width="85%" class="calibre4">The speed to move the mouse in the range 0 (fastest) to 100 (slowest).  Note: a speed of 0 will move the mouse instantly.  If omitted, the default speed (as set by <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> or 2 otherwise) will be used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">D|U</td>
<td class="calibre4">
<p class="calibre8">If this parameter is omitted, each click will consist of a "down" event followed by an "up" event. Alternatively:<br class="calibre12" /> D = Press the mouse button down but do not release it (i.e. generate a down-event). <br class="calibre12" /> U = Release the mouse button (i.e. generate an up-event). </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">R</td>
<td class="calibre4">If this parameter is the letter R, the X and Y coordinates will be treated as offsets from the current mouse position. In other words, the cursor will be moved from its current position by X pixels to the right (left if negative) and Y pixels down (up if negative).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To perform a shift-click or control-click, use the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command before and after the operation as shown in these examples:</p>
<p class="calibre8">; Example #1: <br class="calibre12" /> Send, {Control down}<br class="calibre12" /> MouseClick, left, 55, 233<br class="calibre12" /> Send, {Control up}</p>
<p class="calibre8">; Example #2:<br class="calibre12" /> Send, {Shift down}<br class="calibre12" /> MouseClick, left, 55, 233<br class="calibre12" /> Send, {Shift up} </p>
<p class="calibre8">Some applications such as certain full-screen games may have trouble tracking the mouse if it moves too quickly. The <em class="calibre21">speed</em> parameter or <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> can be used to reduce the speed.</p>
<p class="calibre8 rm">Not all applications obey a <em class="calibre21">ClickCount</em> higher than 1 for turning the mouse wheel. For those applications, use a Loop to turn the wheel more than one notch as in this example, which turns it 5 notches:<br class="calibre12" /> Loop, 5<br class="calibre12" />      MouseClick, WheelUp</p>
<p class="calibre8">The <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a> command can be used to prevent any physical mouse activity by the user from disrupting the simulated mouse events produced by the mouse commands.</p>
<p class="calibre8 tbd">There is an automatic delay after every click-down and click-up of the mouse. Use <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a> to change the length of the delay.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a>,<a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> SetMouseDelay</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>, <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>, <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Double click at the current mouse pos:
MouseClick, left
MouseClick, left
; Same as above:
MouseClick, left, , , 2
; Move to specified coordinates then right-click once:
MouseClick, right, 200, 300
; Here are two hotkeys that simulate the turning of the mouse wheel:
#up::MouseClick, WheelUp, , , 2 ; Turn it by two notches.
#down::MouseClick, WheelDown, , , 2
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="MouseClickDrag.htm" href="#MouseClickDrag.htm">#</a> <h2 class="calibre17">MouseClickDrag</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Clicks and holds the specified mouse button, moves the mouse to the destination coordinates, then releases the button.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">MouseClickDrag, WhichButton, X1, Y1, X2, Y2 [, Speed, R]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">WhichButton</td>
<td class="calibre4">
<p class="calibre8">The button to click: LEFT, RIGHT, MIDDLE, or (in v1.0.09+) just the first letter of each of these.</p>
<p class="calibre8">In v1.0.10+, X1 (XButton1, the 4th mouse button) and X2 (XButton2, the 5th mouse button) are also supported on Windows 2000/XP+. For example: MouseClickDrag, X1, ...</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X1, Y1 </td>
<td class="calibre4">The x/y coordinates of the drag's starting position (the mouse will be moved to these coordinates right before the drag is started). Coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change that. If omitted, the mouse's current position is used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X2, Y2</td>
<td class="calibre4">The x/y coordinates to drag the mouse to (that is, while the button is held down). Coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change that. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Speed</td>
<td width="85%" class="calibre4">The speed to move the mouse in the range 0 (fastest) to 100 (slowest).  Note: a speed of 0 will move the mouse instantly.  If omitted, the default speed (as set by <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> or 2 otherwise) will be used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">R</td>
<td class="calibre4">
<p class="calibre8">In v1.0.11+, if this parameter is the letter R, the X1 and Y1 coordinates will be treated as offsets from the current mouse position. In other words, the cursor will be moved from its current position by X1 pixels to the right (left if negative) and Y1 pixels down (up if negative).</p>
<p class="calibre8">Similarly, the X2 and Y2 coordinates will be treated as offsets from the X1 and Y1 coordinates. For example, the following would first move the cursor down and to the right by 5 pixels from its starting position, and then drag it from that position down and to the right by 10 pixels: MouseClickDrag, 5, 5, 10, 10, , R </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Some applications such as certain full-screen games may have trouble tracking the mouse if it moves too quickly. The <em class="calibre21">Speed</em> parameter or <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> can be used to reduce the speed.</p>
<p class="calibre8">The <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a> command can be used to prevent any physical mouse activity by the user from disrupting the simulated mouse events produced by the mouse commands.</p>
<p class="calibre8">There is an automatic delay after every click-down and click-up of the mouse. This delay also occurs after the movement of the mouse during the drag operation. Use <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a> to change the length of the delay.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>, <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> MouseClickDrag, left, 0, 200, 600, 400 <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="MouseGetPos.htm" href="#MouseGetPos.htm">#</a> <h2 class="calibre17">MouseGetPos</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the current position of the mouse cursor, and optionally which window and control it is hovering over. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">MouseGetPos, [OutputVarX, OutputVarY, OutputVarWin, OutputVarControl] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVarX/Y</td>
<td width="85%" class="calibre4">
<p class="calibre8">The names of the variables in which to store the X and Y coordinates. <span class="tbd">The retrieved coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change to screen coordinates.</span><span class="x11">currently always screen wide</span></p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutputVarWin</td>
<td class="calibre4">
<p class="calibre8">This optional parameter is the name of the variable in which to store the <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a> of the window under the mouse cursor. If the window cannot be determined, this variable will be made blank.</p>
<p class="calibre8">The window does not have to be active to be detected. Hidden windows cannot be detected.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutputVarControl</td>
<td class="calibre4">
<p class="calibre8">This optional parameter is the name of the variable in which to store the name of the control under the mouse cursor. If the control cannot be determined, this variable will be made blank.</p>
<p class="calibre8">The names of controls should always match those shown by the version of Window Spy. However, unlike Window Spy, the window under the mouse cursor does not have to be active for a control to be detected. </p>
<p class="calibre8 x11">This option relies on accessibility support. <a href="#Accessibility.htm">Please read this section</a> to avoid problems.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Any of the output variables may be omitted if the corresponding information is not needed.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>, <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>, <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">MouseGetPos, xpos, ypos
Msgbox, The cursor is at X%xpos% Y%ypos%.
; This example allows you to move the mouse around to see
; the title of the window currently under the cursor:
#Persistent
SetTimer, WatchCursor, 100
return
WatchCursor:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%
return
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="MouseMove.htm" href="#MouseMove.htm">#</a> <h2 class="calibre17">MouseMove</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Moves the mouse cursor.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">MouseMove, X, Y [, <span class="tbd">Speed</span>, R]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">X, Y </td>
<td class="calibre4">The x/y coordinates to move the mouse to. Coordinates are relative to the active window unless <a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a> was used to change that.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Speed</td>
<td width="85%" class="calibre4">The speed to move the mouse in the range 0 (fastest) to 100 (slowest).  Note: a speed of 0 will move the mouse instantly.  If omitted, the default speed (as set by <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> or 2 otherwise) will be used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">R</td>
<td class="calibre4">If this parameter is the letter R, the X and Y coordinates will be treated as offsets from the current mouse position. In other words, the cursor will be moved from its current position by X pixels to the right (left if negative) and Y pixels down (up if negative).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Some applications such as certain full-screen games may have trouble tracking the mouse if it moves too quickly. The <em class="calibre21">speed</em> parameter or <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a> can be used to reduce the speed.</p>
<p class="calibre8">The <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a> command can be used to prevent any physical mouse activity by the user from disrupting the simulated mouse events produced by the mouse commands.</p>
<p class="calibre8">There is an automatic delay after every movement of the mouse. Use <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a> to change the length of the delay.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#CoordMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">CoordMode</a>, <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>, <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>, <a href="#BlockInput.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">BlockInput</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">; Move the mouse to a new position:
MouseMove, 200, 100
; Move the mouse slowly (speed 50 vs. 2) by 20 pixels to the right and 30 pixels down
; from its current location:
MouseMove, 20, 30, 50, R</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetDefaultMouseSpeed.htm" href="#SetDefaultMouseSpeed.htm">#</a> <h2 class="calibre17">SetDefaultMouseSpeed</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the mouse speed that will be used if unspecified in <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>/<a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Click</a>/<a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Drag</a>.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetDefaultMouseSpeed, Speed </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Speed</td>
<td width="85%" class="calibre4">The speed to move the mouse in the range 0 (fastest) to 100 (slowest).  Note: a speed of 0 will move the mouse instantly.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If this command isn't used, the default mouse speed is 2.</p>
<p class="calibre8">The commands <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, and <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a> all have a parameter to override the default mouse speed.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_DefaultMouseSpeed</strong> contains the current setting.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>, <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetDefaultMouseSpeed, 0 ; Move the mouse instantly like AutoIt2.</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetMouseDelay.htm" href="#SetMouseDelay.htm">#</a> <h2 class="calibre17">SetMouseDelay</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the delay that will occur after each mouse movement or click.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetMouseDelay, Delay</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Delay</td>
<td width="85%" class="calibre4">Time in milliseconds. Use -1 for no delay at all and 0 for the smallest possible delay. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A short delay (sleep) is automatically and invisibly done after every mouse movement or click generated by <a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, and <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>. This is done to improve the reliability of scripts because a window sometimes can't keep up with a rapid flood of mouse events.</p>
<p class="calibre8">Due to the granularity of the OS's time-keeping system, delays might be rounded up to the nearest multiple of 10. For example, a delay between 1 and 10 (inclusive) is equivalent to 10 on Windows XP (and probably NT &amp; 2k).</p>
<p class="calibre8">A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all. By contrast, a delay of -1 will never sleep.</p>
<p class="calibre8">If unset, the default delay is 10.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_MouseDelay</strong> contains the current setting.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#MouseMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseMove</a>, <a href="#MouseClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClick</a>, <a href="#MouseClickDrag.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseClickDrag</a>, <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetMouseDelay, 0</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Process.htm" href="#Process.htm">#</a> <h2 class="calibre17">Process</h2> [v1.0.18+]
<hr size="2" class="calibre24" />
<p class="calibre8">Performs one of the following operations on a process: checks if it exists; changes its priority; closes it; waits for it to close.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Process, Cmd, PID-or-Name [, Param3]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Cmd</td>
<td width="85%" class="calibre4">
<p class="calibre8">One of the following words:</p>
<p class="calibre8"><strong class="calibre14">Exist</strong>: Sets <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to the Process ID (PID) if a matching process exists, or 0 otherwise.</p>
<p class="calibre8"><strong class="calibre14">Close</strong>: If a matching process is successfully terminated, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to its former Process ID (PID). Otherwise (there was no matching process or there was a problem terminating it), it is set to 0. Since the process will be abruptly terminated -- possibly interrupting its work at a critical point or resulting in the loss of unsaved data in its windows (if it has any) -- this method should be used only if a process cannot be closed by using <a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a> on one of its windows.</p>
<p class="calibre8"><strong class="calibre14">Priority</strong>: Changes the priority (as seen in Windows Task Manager) of the first matching process to <em class="calibre21">Param3</em> and sets <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to its Process ID (PID). If the <em class="calibre21">PID-or-Name</em> parameter is blank, the script's own priority will be changed. If there is no matching process or there was a problem changing its priority, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0.</p>
<p class="calibre8"><em class="calibre21">Param3</em> should be one of the following letters or words: L (or Low), B (or BelowNormal), N (or Normal), A (or AboveNormal), H (or High), R (or Realtime). Since BelowNormal and AboveNormal are not supported on Windows 95/98/Me/NT4, <em class="calibre21">normal</em> will be automatically substituted for them on those operating systems. Note: Any process not designed to run at Realtime priority might reduce system stability if set to that level.</p>
<p class="calibre8"><strong class="calibre14">Wait</strong>: Waits up to <em class="calibre21">Param3</em> seconds (can contain a decimal point) for a matching process to exist. If <em class="calibre21">Param3</em> is omitted, the command will wait indefinitely. If a matching process is discovered, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to its Process ID (PID). If the command times out, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0.</p>
<p class="calibre8"><strong class="calibre14">WaitClose</strong>: Waits up to <em class="calibre21">Param3</em> seconds (can contain a decimal point) for ALL matching processes to close. If <em class="calibre21">Param3</em> is omitted, the command will wait indefinitely. If all matching processes are closed, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0. If the command times out, <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to the Process ID (PID) of the first matching process that still exists. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">PID-or-Name </td>
<td class="calibre4">
<p class="calibre8">This parameter can be either a number (the PID) or a process name as described below. It can also be left blank to change the priority of the script itself.</p>
<p class="calibre8">PID: The Process ID, which is a number that uniquely identifies one specific process (this number is valid only during the lifetime of that process). The PID of a newly launched process can be determined via the <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> command. Similarly, the PID of a window can be determined with <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>. The Process command itself can also be used to discover a PID.</p>
<p class="calibre8">Name: The name of a process is usually the same as its executable (without path), e.g. notepad.exe or winword.exe. Since a name might match multiple running processes, only the first process will be operated upon. The name is not case sensitive.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Param3</td>
<td class="calibre4">See <em class="calibre21">Cmd</em> above for details.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8">See <em class="calibre21">Cmd</em> above for details.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">For <em class="calibre21">Wait</em> and <em class="calibre21">WaitClose</em>: Processes are checked every 100 milliseconds; the moment the condition is satisfied, the command will cease waiting. In other words, rather than waiting for the timeout to expire, it will immediately set <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel </a>as described above and then continue execution of the script. Also, while the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8"> To work under Windows NT 4.0, this command requires the file PSAPI.DLL, which is normally already present in the AutoHotkey installation directory (i.e. no extra installation steps should be needed even for NT).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a>, <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>, <a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a>, <a href="#WinKill.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinKill</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Example #1:
Run Notepad.exe, , , NewPID
Process, priority, %NewPID%, High
MsgBox The newly launched notepad's PID is %NewPID%.
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #2:
Process, wait, Notepad.exe, 5.5
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
{
MsgBox The specified process did not appear within 5.5 seconds.
return
}
; Otherwise:
MsgBox A matching process has appeared (Process ID is %NewPID%).
Process, priority, %NewPID%, Low
Process, priority, , High ; Have the script set itself to high priority.
WinClose Untitled - Notepad
Process, WaitClose, %NewPID%, 5
if ErrorLevel &lt;&gt; 0 ; The PID still exists.
MsgBox The process did not close within 5 seconds.
</pre><hr class="calibre24"/><pre class="calibre22">
; Example #3: A hotkey to change the priority of the active window's process:
#z:: ; Win+Z hotkey
WinGet, active_pid, PID, A
WinGetTitle, active_title, A
Gui, 5:Add, Text,, Press ESCAPE to cancel, or double-click a new`npriority level for the following window:`n%active_title%
Gui, 5:Add, ListBox, vMyListBox gMyListBox r5, Normal|High|Low|BelowNormal|AboveNormal
Gui, 5:Add, Button, default, OK
Gui, 5:Show,, Set Priority
return
5GuiEscape:
5GuiClose:
Gui, Destroy
return
MyListBox:
if A_GuiControlEvent &lt;&gt; DoubleClick
return
; else fall through to the next label:
5ButtonOK:
GuiControlGet, MyListBox
Gui, Destroy
Process, Priority, %active_pid%, %MyListBox%
if ErrorLevel = 0
MsgBox Error: Its priority could not be changed to "%MyListBox%".
else
MsgBox Success: Its priority was changed to "%MyListBox%".
return</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Run.htm" href="#Run.htm">#</a> <h2 class="calibre17">Run / RunWait</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Runs an external program. Unlike Run, RunWait will wait until the program finishes before continuing. <span class="x11">RunWait only reliably waits when the program is an executable file or program.</span></p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Run, Target [, WorkingDir, <span class="tbd">Max|Min|Hide</span>|UseErrorLevel, OutputVarPID<span class="x11">, OutputVarStdout, OutputVarStderr</span>]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Target</td>
<td width="85%" class="calibre4">
<p class="calibre8">A document, URL, executable file (<span class="rm">.exe, .com, .bat, etc.</span> <span class="x11">a file with executable rights</span>), shortcut (<span class="rm">.lnk</span> <span class="x11">soft link</span>), or system verb to launch (see remarks). If <em class="calibre21">Target</em> is a local file and no path was specified with it, <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> will be searched first. If no matching file is found there, the system will search for and launch the file if it is integrated ("known"), e.g. by being contained in one of the PATH folders.</p>
<p class="calibre8">To pass parameters, add them immediately after the program or document name. If a parameter contains spaces, it is safest to enclose it in double quotes (even though it may work without them in some cases).</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WorkingDir</td>
<td class="calibre4">The working directory for the launched item. Do not enclose the name in double quotes even if it contains spaces. If omitted, the script's own working directory (<a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a>) will be used. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Max|Min|Hide<br class="calibre12" /> UseErrorLevel</td>
<td class="calibre4">
<p class="calibre8">If omitted, <em class="calibre21">Target</em> will be launched normally. Alternatively, it can contain one or more of these words: </p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">Max</strong>: launch maximized</p>
<p class="calibre8"><strong class="calibre14">Min</strong>: launch minimized</p>
<p class="calibre8"><strong class="calibre14">Hide</strong>: launch hidden (cannot be used in combination with either of the above) </p>
</div>
<p class="calibre8"><strong class="calibre14">UseErrorLevel</strong>: This word can be specified alone or in addition to one of the above words (by separating it from the other word with a space). When present, if the launch succeeds for the Run command (not RunWait), <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0. If the launch fails for either Run or RunWait, the following alternate behavior will occur: 1) No warning dialog will be displayed; 2) The current thread will <u class="calibre20">not</u> be terminated; 3) <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to the word ERROR. <span class="x11">This only works when the target is a valid, executable command! So it doesn't work with text files or web urls etc.</span></p>
<p class="calibre8"><span class="rm">Some applications (e.g. Calc.exe) do not obey the requested startup state and thus Max/Min/Hide will have no effect.</span></p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OutputVarPID</td>
<td class="calibre4">For the Run command, this optional parameter is the name of the variable in which to store the newly launched program's unique <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process ID (PID)</a>. The variable will be made blank if the PID could not be determined, which usually happens if a system verb, document, or shortcut is launched rather than a direct executable file.</td>
</tr>
<tr class="calibre3">
<td class="calibre4"><span class="x11">OutputVarStdout</span></td>
<td class="calibre4"><span class="x11">For the RunWait command, this optional parameter is the name of the variable in which to store the program's full text output. This only works when the target is a valid, executable command.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4"><span class="x11">OutputVarStderr</span></td>
<td class="calibre4"><span class="x11">For the RunWait command, this optional parameter is the name of the variable in which to store the program's full error output. This only works when the target is a valid, executable command.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Unlike Run, RunWait will wait until <em class="calibre21">Target</em> is closed or exits, at which time <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to the program's exit code (as a signed 32-bit value). Some programs will appear to return immediately even though they are still running; these programs spawn another process.</p>
<p class="calibre8">If <em class="calibre21">Target</em> cannot be launched, an error window will be displayed, after which the script will behave as though an <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit </a>command were encountered. To prevent this, include the string <strong class="calibre14">UseErrorLevel</strong> in the 3rd parameter.</p>
<p class="calibre8">Performance may be slightly improved if <em class="calibre21">Target</em> is an exact path, e.g. Run, mousepad "/a/b/Test.txt" rather than Run, /a/b/Test.txt</p>
<p class="calibre8">System verbs correspond to actions available in a file's right-click menu in the Explorer. If a file is launched without a verb, the default verb (usually "open") for that particular file type will be used. If specified, the verb should be followed by the name of the target file. The following verbs are currently supported:</p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="8%" class="calibre4">properties</td>
<td width="92%" class="calibre4"><span class="tbd">Displays the Explorer's properties window for the indicated file. Example: Run, properties C:\autoexec.bat<br class="calibre12" /> Note: The properties window will automatically close when the script terminates. To prevent this, use <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a> to have the script wait for the properties window to close.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">find</td>
<td class="calibre4"><span class="tbd">Opens an instance of the Explorer's Search Companion or Find File window at the indicated folder. Example: Run, find D:\ </span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">explore</td>
<td class="calibre4">Opens an instance of Explorer at the indicated folder. Example: Run, explore %ProgramFiles%. <ahk class="x11">You can do that, but folders are being opened just fine without this verb, so it's unnecessary.</ahk> </td>
</tr>
<tr class="calibre3">
<td class="calibre4">edit</td>
<td class="calibre4">Opens the indicated file for editing. <span class="rm">It might not work if the indicated file's type does not have an "edit" action associated with it.</span> Example: Run, edit /a/b/My File.txt</td>
</tr>
<tr class="calibre3">
<td class="calibre4">open</td>
<td class="calibre4">Opens the indicated file (normally not needed because it is the default action for most file types). Example: Run, open My File.txt</td>
</tr>
<tr class="calibre3">
<td class="calibre4">print</td>
<td class="calibre4">Prints the indicated file with the associate application, if any. Example: Run, print My File.txt <span class="x11">This currently just sends the file to `lp` which expects you to have a default printer set up. Untested.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8">While RunWait is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8">To launch a program with environment variables set, use <a href="#EnvSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">EnvSet</a>. Just prefixing them like `Run, VAR=VALUE cmd` won't work.</p>
<p class="calibre8 x11">Native shell features like redirect (>) or background jobs (&) are not available. Also, ahk variables can not span multiple params. For example, if variable abc contains spaces, then `Run, %abc%` would treat the whole contents of abc as the command path and not split it up. If you really need to work around this, you can invoke the shell directly, e.g. Run, bash -c 'bash code...'.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#RunAs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunAs</a>, <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a>, <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">Run, mousepad, /a/b, max
Run, ReadMe.doc, , Max UseErrorLevel ; Launch maximized and don't display dialog if it fails.
if ErrorLevel = ERROR
MsgBox The document could not be launched.
RunWait, echo -n Text to stdout && echo -n Text to stderr >&2 && exit 5,,,, stdout, stderr
Echo, Exit code: %errorlevel%`, stdout: %stdout%`, stderr: %stderr%
RunWait, ls / &gt;&gt;/a/b/DirTest.txt, , min
Run, /a/b/DirTest.txt
RunWait, ls ~,,,, out
MsgBox %out%
Run, www.autohotkey.com ; i.e. any URL can be launched.
Run, mailto:support@autohotkey.com ; This should open the default e-mail application.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="RunAs.htm" href="#RunAs.htm">#</a> <h2 class="calibre17">RunAs</h2> [v1.0.08+]
<hr size="2" class="calibre24" />
<p class="calibre8">Specifies a set of user credentials to use for all subsequent uses of <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> and <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a>. 2000/XP or later ONLY.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">RunAs [, User, Password, Domain] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong> </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">User</td>
<td width="85%" class="calibre4">If this and the other parameters are all omitted, the RunAs feature will be turned off, which restores <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> and <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> to their default behavior. Otherwise, this is the username under which new processes will be created. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Password</td>
<td class="calibre4"><em class="calibre21">User</em>'s password.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Domain</td>
<td class="calibre4">
<p class="calibre8"><em class="calibre21">User</em>'s domain. To use a local account, leave this blank. If that fails to work, try using @YourComputerName.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Only Windows XP/2000 or later are supported; this command has no effect on other operating systems. NT4 users should install and use the SU command from the NT Resource Kit instead.</p>
<p class="calibre8">This command does nothing other than notify AutoHotkey to use (or not use) alternate user credentials for all subsequent uses of <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> and <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a>.</p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is not changed by this command. If an invalid <em class="calibre21">User</em>, <em class="calibre21">Password</em>, or <em class="calibre21">Domain</em> is specified, <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> and <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> will display an error message explaining the problem.</p>
<p class="calibre8">While the RunAs feature is in effect, <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a> and <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> will not able to launch documents, URLs, or system verbs. In other words, the file to be launched must be an executable file.</p>
<p class="calibre8"> The "Secondary Logon" service must be set to manual or automatic for this command to work (the OS should automatically start it upon demand if set to manual).</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a>, <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">RunAs, Administrator, MyPassword<br class="calibre12" /> Run, RegEdit.exe<br class="calibre12" /> RunAs ; Reset to normal behavior.</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Shutdown.htm" href="#Shutdown.htm">#</a> <h2 class="calibre17">Shutdown</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Shuts down, restarts, or logs off the system.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Shutdown, Code</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Code</td>
<td width="85%" class="calibre4">A combination of shutdown codes.  See "remarks".</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The shutdown code is a combination of the following values:</p>
<table border="1" width="23%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="68%" class="calibre4">Logoff</td>
<td width="32%" class="calibre4">0</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Shutdown</td>
<td class="calibre4">1</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Reboot</td>
<td class="calibre4">2</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Force</td>
<td class="calibre4">4</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Power down</td>
<td class="calibre4">8</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8">Add the required values together.  e.g. if you want to shutdown and power down the code would be <strong class="calibre14">9</strong> (shutdown + power down = 1 + 8 = 9).</p>
<p class="calibre8">The "Force" value forces all open applications to close. It should only be used in an emergency because it may cause any open applications to lose data.</p>
<p class="calibre8">The "Power down" value shuts down the system and turns off the power.</p>
<p class="calibre8">A script can detect when the system is shutting down or the user is logging off via <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a>. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Run</a>, <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>, <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> ; Force a reboot (reboot + force = 2 + 4 = 6):<br class="calibre12" /> Shutdown, 6</p>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="RegDelete.htm" href="#RegDelete.htm">#</a> <h2 class="calibre17">RegDelete</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Deletes a subkey or value from the registry. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">RegDelete, RootKey, SubKey [, ValueName]</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="RegRead.htm" href="#RegRead.htm">#</a> <h2 class="calibre17">RegRead</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Reads a value from the registry.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">RegRead, OutputVar, RootKey, SubKey [, ValueName]<br class="calibre12" /> (Obsolete 5-param method): RegRead, OutputVar, ValueType, RootKey, SubKey [, ValueName]</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="RegWrite.htm" href="#RegWrite.htm">#</a> <h2 class="calibre17">RegWrite</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Writes a value to the registry.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">RegWrite, ValueType, RootKey, SubKey [, ValueName, Value]</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SoundGet.htm" href="#SoundGet.htm">#</a> <h2 class="calibre17">SoundGet</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves various settings from a sound device (master mute, master volume, etc.)</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SoundGet, OutputVar [, ComponentType, ControlType, DeviceNumber]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved setting, which is either a floating point number between 0 and 100 (inclusive) or the word ON or OFF (used only for <em class="calibre21">ControlTypes</em> ONOFF, MUTE, MONO, LOUDNESS, STEREOENH, and BASSBOOST). The variable will be made blank if there was a problem retrieving the setting. The format of the floating point number, such as its decimal places, is determined by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ComponentType</td>
<td class="calibre4">
<p class="calibre8">If omitted or blank, it defaults to the word MASTER. Otherwise, it can be one of the following words: MASTER (synonymous with SPEAKERS), DIGITAL, LINE, MICROPHONE, SYNTH, CD, TELEPHONE, PCSPEAKER, WAVE, AUX, or ANALOG. If the sound device lacks the specified <em class="calibre21">ComponentType</em>, ErrorLevel will indicate the problem.</p>
<p class="calibre8">The component labled Auxiliary in some mixers might be accessible as ANALOG rather than AUX.</p>
<p class="calibre8">If a device has more than one instance of <em class="calibre21">ComponentType</em> (two of type LINE, for example) and you wish to use one other than the first, append a colon and a number to this parameter. For example: Analog:2 is the second analog input.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ControlType</td>
<td class="calibre4">If omitted or blank, it defaults to VOLUME. Otherwise, it can be one of the following words: VOLUME (or VOL), ONOFF, MUTE, MONO, LOUDNESS, STEREOENH, BASSBOOST, PAN, QSOUNDPAN, BASS, TREBLE, or EQUALIZER. If the specified <em class="calibre21">ComponentType</em> lacks the specified <em class="calibre21">ControlType</em>, ErrorLevel will indicate the problem. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">DeviceNumber</td>
<td class="calibre4">If this parameter is omitted, it defaults to 1 (the first sound device), which is usually the system's default device for recording and playback. Specify a number higher than 1 to operate upon a different sound device.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0 if the command succeeded. Otherwise, it is set to one of the following phrases:</p>
<table border="1" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Invalid Control Type or Component Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Can't Open Specified Mixer</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Mixer Doesn't Support This Component Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Mixer Doesn't Have That Many of That Component Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Component Doesn't Support This Control Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Can't Get Current Setting</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The operating system's mixer panel or the software that came with your sound device may give you some idea of what features it supports. For example, if the Play Control or Master Volume area has an Advanced button, pressing that button may reveal which <em class="calibre21">ControlTypes</em> other than VOLUME (such as BASS &amp; TREBLE) are supported when <em class="calibre21">ComponentType</em> is MASTER.</p>
<p class="calibre8">Use <a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a> to change a setting. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a>, <a href="#SoundGetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGetWaveVolume</a>, <a href="#SoundSetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSetWaveVolume</a>, <a href="#SoundPlay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundPlay</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">SoundGet, master_volume
MsgBox, Master volume is %master_volume% percent.
SoundGet, master_mute, , mute
MsgBox, Master Mute is currently %master_mute%.
SoundGet, bass_level, Master, bass
if ErrorLevel &lt;&gt; 0
MsgBox, Error Description: %ErrorLevel%
else
MsgBox, The BASS level for MASTER is %bass_level% percent.
SoundGet, microphone_mute, Microphone, mute
if microphone_mute = Off
MsgBox, The microphone is not muted.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SoundGetWaveVolume.htm" href="#SoundGetWaveVolume.htm">#</a> <h2 class="calibre17">SoundGetWaveVolume</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the wave output volume for a sound device.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SoundGetWaveVolume, OutputVar [, DeviceNumber]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved volume level, which is a floating point number between 0 and 100 inclusive. The variable will be made blank if there was a problem retrieving the volume. The format of the floating point number, such as its decimal places, is determined by <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">DeviceNumber</td>
<td class="calibre4">If this parameter is omitted, it defaults to 1 (the first sound device), which is usually the system's default device for recording and playback. Specify a number higher than 1 to operate upon a different sound device.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The current wave output volume level can be set via <a href="#SoundSetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSetWaveVolume</a>. Settings such as Master Volume, Synth, Microphone, Mute, Treble, and Bass can be set and retrieved using <a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a> and <a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SoundSetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSetWaveVolume</a>, <a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a>, <a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a>, <a href="#SoundPlay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundPlay</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8"> SoundGetWaveVolume, OutputVar<br class="calibre12" /> MsgBox, The current wave output volume level is %OutputVar%`%.</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SoundPlay.htm" href="#SoundPlay.htm">#</a> <h2 class="calibre17">SoundPlay</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Play a sound, video, or other supported file type. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SoundPlay, Filename [, wait] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Filename</td>
<td class="calibre4">The name of the file to be played, which is assumed to be in <a href="#Variables.htm__WorkingDir" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_WorkingDir%</a> if an absolute path isn't specified.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">wait</td>
<td width="85%" class="calibre4">
<p class="calibre8">If omitted, the script's current <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> will continue running while the file is playing. If it's 1 or the word WAIT, the current thread will wait until the file is finished playing. Even while waiting, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">All Windows OSes should be able to play .wav files. However, other files (.mp3, .avi, etc.) might not be playable if the right codecs or features aren't installed on the OS.</p>
<p class="calibre8">If a file is playing and the current script or a different script plays a second file, the first file will be stopped so that the second one can play.</p>
<p class="calibre8">To stop a file that is currently playing, use SoundPlay on a nonexistent filename as in this example: SoundPlay, Nonexistent.avi</p>
<p class="calibre8">If the script is terminated, any currently-playing file that it started will stop.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a>, <a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a>, <a href="#SoundGetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGetWaveVolume</a>, <a href="#SoundSetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSetWaveVolume</a>, <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Threads</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> SoundPlay, %SystemRoot%\Media\ding.wav</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SoundSet.htm" href="#SoundSet.htm">#</a> <h2 class="calibre17">SoundSet</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes various settings of a sound device (master mute, master volume, etc.)</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SoundSet, NewSetting [, ComponentType, ControlType, DeviceNumber]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">NewSetting</td>
<td width="85%" class="calibre4">
<p class="calibre8">Percentage number between -100 and 100 inclusive (it can be a floating point number). If the number begins with a plus or minus sign, the <strong class="calibre14">current setting </strong> will be adjusted up or down by the indicated amount. Otherwise, the setting will be set explicitly to the level indicated by <em class="calibre21">NewSetting</em>.</p>
<p class="calibre8">For <em class="calibre21">ControlTypes</em> with only two possible settings -- namely ONOFF, MUTE, MONO, LOUDNESS, STEREOENH, and BASSBOOST -- any positive number will turn on the setting and a zero will turn it off. <strong class="calibre14">However</strong>, if the number begins with a plus or minus sign, the setting will be toggled (set to the opposite of its current state).</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ComponentType</td>
<td class="calibre4">
<p class="calibre8">If omitted or blank, it defaults to the word MASTER. Otherwise, it can be one of the following words: MASTER (synonymous with SPEAKERS), DIGITAL, LINE, MICROPHONE, SYNTH, CD, TELEPHONE, PCSPEAKER, WAVE, AUX, or ANALOG. If the sound device lacks the specified <em class="calibre21">ComponentType</em>, ErrorLevel will indicate the problem.</p>
<p class="calibre8">The component labeled Auxiliary in some mixers might be accessible as ANALOG rather than AUX.</p>
<p class="calibre8">If a device has more than one instance of <em class="calibre21">ComponentType</em> (two of type LINE, for example) and you wish to use one other than the first, append a colon and a number to this parameter. For example: Analog:2 is the 2nd analog input.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ControlType</td>
<td class="calibre4">If omitted or blank, it defaults to VOLUME. Otherwise, it can be one of the following words: VOLUME (or VOL), ONOFF, MUTE, MONO, LOUDNESS, STEREOENH, BASSBOOST, PAN, QSOUNDPAN, BASS, TREBLE, or EQUALIZER. If the specified <em class="calibre21">ComponentType</em> lacks the specified <em class="calibre21">ControlType</em>, ErrorLevel will indicate the problem. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">DeviceNumber</td>
<td class="calibre4">If this parameter is omitted, it defaults to 1 (the first sound device), which is usually the system's default device for recording and playback. Specify a number higher than 1 to operate upon a different sound device.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0 if the command succeeded. Otherwise, it is set to one of the following phrases:</p>
<table border="1" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Invalid Control Type or Component Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Can't Open Specified Mixer</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Mixer Doesn't Support This Component Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Mixer Doesn't Have That Many of That Component Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Component Doesn't Support This Control Type</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Can't Get Current Setting</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Can't Change Setting</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The operating system's mixer panel or the software that came with your sound device may give you some idea of what features it supports. For example, if the Play Control or Master Volume area has an Advanced button, pressing that button may reveal which <em class="calibre21">ControlTypes</em> other than VOLUME (such as BASS &amp; TREBLE) are supported when <em class="calibre21">ComponentType</em> is MASTER.</p>
<p class="calibre8">Use <a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a> to retrieve the current value of a setting. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a>, <a href="#SoundGetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGetWaveVolume</a>, <a href="#SoundSetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSetWaveVolume</a>, <a href="#SoundPlay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundPlay</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">SoundSet, 50 ; Set the master volume to 50%
SoundSet, 1, Microphone, mute ; mute the microphone
SoundSet, +1, , mute ; Toggle the master mute (set it to the opposite state)
SoundSet, +20, Master, bass ; Increase bass level by 20%.
if ErrorLevel &lt;&gt; 0
MsgBox, The BASS setting is not supported for MASTER.
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SoundSetWaveVolume.htm" href="#SoundSetWaveVolume.htm">#</a> <h2 class="calibre17">SoundSetWaveVolume</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the wave output volume for a sound device.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SoundSetWaveVolume, Percent [, DeviceNumber]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Percent</td>
<td width="85%" class="calibre4">Percentage number between -100 and 100 inclusive (it can be a floating point number). If the number begins with a plus or minus sign, the <strong class="calibre14">current volume level</strong> will be adjusted up or down by the indicated amount. Otherwise, the volume will be set explicitly to the level indicated by <em class="calibre21">Percent</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">DeviceNumber</td>
<td class="calibre4">If this parameter is omitted, it defaults to 1 (the first sound device), which is usually the system's default device for recording and playback. Specify a number higher than 1 to operate upon a different sound device.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The current wave output volume level can be retrieved via <a href="#SoundGetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGetWaveVolume</a>. Settings such as Master Volume, Synth, Microphone, Mute, Treble, and Bass can be set and retrieved using <a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a> and <a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SoundGetWaveVolume.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGetWaveVolume</a>, <a href="#SoundSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundSet</a>, <a href="#SoundGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundGet</a>, <a href="#SoundPlay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SoundPlay</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8"> SoundSetWaveVolume, 50 ; Set the volume to its half-way point.</p>
<p class="calibre8">SoundSetVolume, -10 ; Decrease the current level by 10 (e.g. 80 would become 70).</p>
<p class="calibre8">SoundSetVolume, +20 ; Increase the current level by 20.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="FormatTime.htm" href="#FormatTime.htm">#</a> <h2 class="calibre17">FormatTime</h2> [v1.0.24+]
<hr size="2" class="calibre24" />
<p class="calibre8">Transforms a <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> timestamp into the specified date/time format.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">FormatTime, OutputVar [, <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a>, Format]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the result.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">YYYYMMDD...</td>
<td class="calibre4">Leave this parameter blank to use the current local date and time. Otherwise, specify all or the leading part of a timestamp in the <a href="#FileSetTime.htm__YYYYMMDD" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">YYYYMMDDHH24MISS</a> format. If the date and/or time portion of the timestamp is invalid -- such as February 29th of a non-leap year -- the date and/or time will be omitted from <em class="calibre21">OutputVar</em>. Although only years between 1601 and 9999 are supported, a formatted time can still be produced for earlier years as long as the time portion is valid.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Format</td>
<td width="85%" class="calibre4">
<p class="calibre8">If omitted, it defaults to the time followed by the long date, both of which will be formatted according to the current user's locale. Example: 4:55 PM Saturday, November 27, 2004</p>
<p class="calibre8">Otherwise, specify one or more of the date-time formats below, along with any literal spaces and punctuation in between (commas do not need to be escaped; they can be used normally). In the following example, note that MM must be capitalized: MM/dd/yyyy hh:mm tt</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Date Formats <span class="calibre40">(case sensitive)</span></strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">d</td>
<td class="calibre4">Day of the month without leading zero (1 - 31)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">dd</td>
<td class="calibre4">Day of the month with leading zero (01 – 31)</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">ddd</td>
<td width="85%" class="calibre4">Abbreviated name for the day of the week (e.g. Mon) in the current user's language</td>
</tr>
<tr class="calibre3">
<td class="calibre4">dddd</td>
<td class="calibre4">Full name for the day of the week (e.g. Monday) in the current user's language</td>
</tr>
<tr class="calibre3">
<td class="calibre4">M</td>
<td class="calibre4">Month without leading zero (1 – 12)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MM</td>
<td class="calibre4">Month with leading zero (01 – 12)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MMM</td>
<td class="calibre4">Abbreviated month name (e.g. Jan) in the current user's language</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MMMM</td>
<td class="calibre4">Full month name (e.g. January) in the current user's language</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Y</td>
<td class="calibre4">Year without century, without leading zero (0 – 99)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">yy</td>
<td class="calibre4">Year without century, with leading zero (00 - 99)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">yyyy</td>
<td class="calibre4">Year with century. Example: 2005</td>
</tr>
<tr class="calibre3">
<td class="calibre4">gg</td>
<td class="calibre4">Period/era string for the current user's locale (blank if none)</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Time Formats <span class="calibre40">(case sensitive)</span></strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">h</td>
<td class="calibre4">Hours without leading zero; 12-hour format (1 - 12)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">hh</td>
<td class="calibre4">Hours with leading zero; 12-hour format (01 – 12)</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">H</td>
<td width="85%" class="calibre4">Hours without leading zero; 24-hour format (0 - 23)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">HH</td>
<td class="calibre4">Hours with leading zero; 24-hour format (00– 23)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">m</td>
<td class="calibre4">Minutes without leading zero (0 – 59)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">mm</td>
<td class="calibre4">Minutes with leading zero (00 – 59)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">s</td>
<td class="calibre4">Seconds without leading zero (0 – 59)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ss</td>
<td class="calibre4">Seconds with leading zero (00 – 59)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">t</td>
<td class="calibre4">Single character time marker, such as A or P (depends on locale)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">tt</td>
<td class="calibre4">Multi-character time marker, such as AM or PM (depends on locale)</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">The following formats must be used <span class="calibre40">alone</span>; that is, with no other formats or text present in the <em class="calibre21">Format</em> parameter. These formats are not case sensitive.</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">(Blank)</td>
<td class="calibre4">Leave <em class="calibre21">Format</em> blank to produce the time followed by the long date. For example, in some locales it might appear as 4:55 PM Saturday, November 27, 2004</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Time</td>
<td class="calibre4">Time representation for the current user's locale, such as 5:26 PM</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">ShortDate</td>
<td width="85%" class="calibre4">Short date representation for the current user's locale, such as 02/29/04</td>
</tr>
<tr class="calibre3">
<td class="calibre4">LongDate</td>
<td class="calibre4">Long date representation for the current user's locale, such as Friday, April 23, 2004</td>
</tr>
<tr class="calibre3">
<td class="calibre4">YearMonth</td>
<td class="calibre4">Year and month format for the current user's locale, such as February, 2004 </td>
</tr>
<tr class="calibre3">
<td class="calibre4">YDay</td>
<td class="calibre4">Day of the year without leading zeros (1 – 366)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">YDay0</td>
<td class="calibre4">Day of the year with leading zeros (001 – 366)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WDay</td>
<td class="calibre4">Day of the week (1 – 7). Sunday is 1.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">YWeek</td>
<td class="calibre4">The ISO 8601 full year and week number. Example: 200453. If the week containing January 1st has four or more days in the new year, it is considered week 1. Otherwise, it is the last week of the previous year, and the next week is week 1. Both January 4th and the first Thursday of January are always in week 1.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Additional Options</strong></p>
<p class="calibre8">The following options can appear inside the <em class="calibre21">YYYYMMDDHH24MISS</em> parameter immediately after the timestamp (if there is no timestamp, they may be used alone). In the following example, note the lack of commas between the last four items: FormatTime, OutputVar, 20040228 LSys D1 D4</p>
<p class="calibre8">R: Reverse. Have the date come before the time (meaningful only when <em class="calibre21">Format</em> is blank).</p>
<p class="calibre8">Ln: If this option is not present, the current user's locale is used to format the string. To use the system's locale instead, specify LSys. To use a specific locale, specify the letter L followed by a hexadecimal or decimal locale identifier (LCID). For information on how to construct an LCID, search <a href="http://www.microsoft.com" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">www.microsoft.com</a> for the following phrase: Locale Identifiers</p>
<p class="calibre8">Dn: Date options. Specify for <strong class="calibre14">n</strong> one of the following numbers:<br class="calibre12" /> 0: Force the default options to be used. This also causes the short date to be in effect. <br class="calibre12" /> 1: Use short date (meaningful only when <em class="calibre21">Format</em> is blank; not compatible with 2 and 8).<br class="calibre12" /> 2: Use long date (meaningful only when <em class="calibre21">Format</em> is blank; not compatible with 1 and 8).<br class="calibre12" /> 4: Use alternate calendar (if any).<br class="calibre12" /> 8: Use Year-Month format (meaningful only when <em class="calibre21">Format</em> is blank; not compatible with 1 and 2). Requires Windows 2000 or later.<br class="calibre12" /> 0x10: Add marks for left-to-right reading order layout. Requires Windows 2000 or later.<br class="calibre12" /> 0x20: Add marks for right-to-left reading order layout. Requires Windows 2000 or later.<br class="calibre12" /> 0x80000000: Do not obey any overrides the user may have in effect for the system's default date format. <br class="calibre12" /> 0x40000000: Use the system ANSI code page for string translation instead of the locale's code page.</p>
<p class="calibre8">Tn: Time options. Specify for <strong class="calibre14">n</strong> one of the following numbers:<br class="calibre12" /> 0: Force the default options to be used. This also causes minutes and seconds to be shown.<br class="calibre12" /> 1: Omit minutes and seconds.<br class="calibre12" /> 2: Omit seconds. <br class="calibre12" /> 4: Omit time marker (e.g. AM/PM).<br class="calibre12" /> 8: Always use 24-hour time rather than 12-hour time (but specify T12 to additionally omit the AM/PM indicator). <br class="calibre12" /> 0x80000000: Do not obey any overrides the user may have in effect for the system's default time format. <br class="calibre12" /> 0x40000000: Use the system ANSI code page for string translation instead of the locale's code page.</p>
<p class="calibre8"><strong class="calibre14">Note</strong>: Dn and Tn may be repeated to put more than one option into effect, such as this example: FormatTime, OutputVar, 20040228 D2 D4 T1 T8</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Letters and numbers that you want to be transcribed literally from <em class="calibre21">Format</em> into <em class="calibre21">OutputVar</em> should be enclosed in single quotes as in this example: 'Date:' MM/dd/yy 'Time:' hh:mm:ss tt</p>
<p class="calibre8">By contrast, non-alphanumeric characters such as spaces, tabs, linefeeds (`n), slashes, colons, commas, and other punctuation do not need to be enclosed in single quotes. The exception to this is the single quote character itself: to produce it literally, use four consecutive single quotes (''''), or just two if the quote is already inside an outer pair of quotes.</p>
<p class="calibre8">If <em class="calibre21">Format</em> contains date and time elements together, they must not be intermixed. In other words, the string should be dividable into two halves: a time half and a date half. For example, a format string consisting of "hh yyyy mm" would not produce the expected result because it has a date element in between two time elements.</p>
<p class="calibre8"> When <em class="calibre21">Format</em> contains a numeric day of the month (either d or dd) followed by the full month name (MMMM), the genitive form of the month name is used (if the language has a genitive form).</p>
<p class="calibre8">If <em class="calibre21">Format</em> contains more than 2000 characters, <em class="calibre21">OutputVar</em> will be made blank.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>, <a href="#Transform.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Transform</a>, <a href="#Variables.htm__date" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">built-in date and time variables</a>, <a href="#FileGetTime.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileGetTime</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">FormatTime, TimeString
MsgBox The current time and date (time first) is %TimeString%.
FormatTime, TimeString, R
MsgBox The current time and date (date first) is %TimeString%.
FormatTime, TimeString,, Time
MsgBox The current time is %TimeString%.
FormatTime, TimeString, T12, Time
MsgBox The current 24-hour time is %TimeString%.
FormatTime, TimeString,, LongDate
MsgBox The current date (long format) is %TimeString%.
FormatTime, TimeString, 20050423220133, dddd MMMM d, yyyy hh:mm:ss tt
MsgBox The specified date and time, when formatted, is %TimeString%.
FormatTime, TimeString, 200504, 'Month Name': MMMM`n'Day Name': dddd
MsgBox %TimeString%
FormatTime, YearWeek, 20050101, YWeek
MsgBox January 1st of 2005 is in the following ISO year and week number: %YearWeek%
FileSelectFile, FileName, 3,, Pick a file
if FileName = ; The user didn't pick a file.
return
FileGetTime, FileTime, %FileName%
FormatTime, FileTime, %FileTime% ; Since the last parameter is omitted, the long date and time are retrieved.
MsgBox The selected file was last modified at %FileTime%.</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfInString.htm" href="#IfInString.htm">#</a> <h2 class="calibre17">IfInString / IfNotInString</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks if a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> contains the specified string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IfInString, var, SearchString <br class="calibre12" /> IfNotInString, var, SearchString </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">var</td>
<td width="85%" class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> whose contents will be searched for a match. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">SearchString</td>
<td class="calibre4">The string to search for.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The built-in variables <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a> and <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Tab%</a> contain a single space and a single tab character, respectively, which might be useful when searching for these characters alone. </p>
<p class="calibre8">Another command can appear on the same line as this one. In other words, both of these are equivalent: </p>
<pre class="calibre22">IfInString, MyVar, abc, Gosub, Process1
IfInString, MyVar, abc
Gosub, Process1</pre>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual</a>, <a href="#IfIn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var in/contains MatchList</a>, <a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var between</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var is type</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Blocks</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Haystack = abcdefghijklmnopqrs
Needle = abc
IfInString, Haystack, %Needle%
{
MsgBox, The string was found.
return
}
else
Sleep, 1</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfIn.htm" href="#IfIn.htm">#</a> <h2 class="calibre17">If var [not] in value1,value2,... </h2> [v1.0.18+]<br class="calibre12" />
<span class="calibre17">If var [not] contains value1,value2,... </span>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks whether a <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable's</a> contents match one of the items in a list.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">
<p class="calibre8">if <em class="calibre21">Var</em> in <em class="calibre21">MatchList</em><em class="calibre21" /> <br class="calibre12" /> if <em class="calibre21">Var</em> not in <em class="calibre21">MatchList<br class="calibre12" />
</em>if <em class="calibre21">Var</em> contains <em class="calibre21">MatchList</em><br class="calibre12" /> if <em class="calibre21">Var</em> not contains <em class="calibre21">MatchList</em> </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Var</td>
<td width="85%" class="calibre4">The name of the <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> whose contents will be checked. For the "in" operator, an exact match with one of the list items is required. For the "contains" operator, a match occurs more easily: whenever <em class="calibre21">Var</em> contains one of the list items as a substring.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">MatchList</td>
<td class="calibre4">
<p class="calibre8">A comma-separated list of strings, each of which will be compared to the contents of <em class="calibre21">Var</em> for a match. <strong class="calibre14">Any spaces or tabs around the delimiting commas are significant</strong>, meaning that they are part of the match string. For example, if <em class="calibre21">MatchList</em> is "ABC , XYZ", <em class="calibre21">Var</em> must contain either "ABC " (trailing space) or " XYZ" (leading space) to cause a match.</p>
<p class="calibre8">Two consecutive commas results in a single literal comma. For example, the following would produce a single literal comma at the end of string1: "string1,,,string2". Similarly, the following list contains only a single item with a literal comma inside it: "single,,item". To include a blank item in the list, make the first character a comma as in this example: ,string1,string2 (when using the "contains" operator, a blank item will always result in a match since the empty string is found in all strings).</p>
<p class="calibre8">Because the items in <em class="calibre21">MatchList</em> are not treated as individual parameters, the list can be contained entirely within a variable. In fact, all or part of it must be contained in a variable if its length exceeds 16383 since that is the maximum length of any script line. For example, <em class="calibre21">MatchList</em> might consist of %List1%,%List2%,%List3% -- where each of the sublists contains a large list of match phrases.</p>
<p class="calibre8 tbd">Any single item in the list that is longer than 16384 characters will have those extra characters treated as a new list item. Thus, it is usually best to avoid including such items.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The comparison is always done alphabetically, not numerically. For example, the string "11" would not match the list item "11.0".</p>
<p class="calibre8">The "contains" operator is the same as using <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString/IfNotInString</a> except that multiple search strings are supported (any one of which will cause a match).</p>
<p class="calibre8"><a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"><em class="calibre21">"StringCaseSense</em></a><em class="calibre21"> On</em>" can be used to make the comparison case sensitive.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var between</a>, <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual/Greater/Less</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> Blocks</a>, <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Else</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">if var in exe,bat,com
MsgBox The file extension is an executable type.
if var in 1,2,3,5,7,11 ; Avoid spaces in list.
MsgBox %var% is a small prime number.
if var in %MyItemList%
MsgBox %var% is in the list.
InputBox, UserInput, Enter YES or NO
if UserInput not in yes,no
MsgBox Your input is not valid.
WinGetTitle, active_title, A
if active_title contains Address List.txt,Customer List.txt
MsgBox One of the desired windows is active.
if active_title not contains metapad,Notepad
MsgBox But the file is not open in either Metapad or Notepad.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Sort.htm" href="#Sort.htm">#</a> <h2 class="calibre17">Sort</h2> [v1.0.13+]
<hr size="2" class="calibre24" />
<p class="calibre8">Arranges a variable's contents in alphabetical or numerical order.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Sort, VarName [, Options]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">
<p class="calibre8">VarName</p>
</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of the variable whose contents will be sorted.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Options</td>
<td class="calibre4">See list below.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Options</strong></p>
<p class="calibre8"><u class="calibre20">A string of zero or more of the following letters (in any order, with optional spaces in between):</u></p>
<p class="calibre8"><strong class="calibre14">C</strong>: Case sensitive sort (ignored if the <strong class="calibre14">N</strong> option is also present).</p>
<p class="calibre8"><strong class="calibre14">Dx</strong>: Specifies <strong class="calibre14">x</strong> as the delimiter character, which determines where each item in <em class="calibre21">VarName </em>begins and ends. If this option is not present, <strong class="calibre14">x</strong> defaults to linefeed (`n). When linefeed is the delimiter, <em class="calibre21">VarName</em> will be correctly sorted if its lines end in either LF (`n) or CR+LF (`r`n).</p>
<p class="calibre8"><strong class="calibre14">N</strong>: Numeric sort: Each item is assumed to be a number rather than a string (for example, if this option is not present, the string 233 is considered to be less than the string 40 due to alphabetical ordering). Both decimal and hexadecimal strings (e.g. 0xF1) are considered to be numeric. Strings that don't start with a number are considered to be zero for the purpose of the sort. Numbers are treated as 64-bit signed values.</p>
<p class="calibre8"><strong class="calibre14">Pn</strong>: Sorts items based on character position <strong class="calibre14">n</strong> (do not use hexadecimal for <strong class="calibre14">n</strong>). If this option is not present, <strong class="calibre14">n</strong> defaults to 1, which is the position of the first character. The sort compares each string to the others starting at its <strong class="calibre14">n</strong>th character. If <strong class="calibre14">n</strong> is greater than the length of any string, that string is considered to be blank for the purpose of the sort. When used with option <strong class="calibre14">N</strong> (numeric sort), the string's character position is used, which is not necessarily the same as the number's digit position.</p>
<p class="calibre8"><strong class="calibre14">R</strong>: Sorts in reverse order (alphabetically or numerically depending on the other options).</p>
<p class="calibre8"><strong class="calibre14">Random</strong> [v1.0.24+]: Sorts in random order. This option causes all other options except <strong class="calibre14">D</strong> and <strong class="calibre14">Z</strong> to be ignored. Examples:<br class="calibre12" /> Sort, MyVar, Random<br class="calibre12" /> Sort, MyVar, Random Z D| </p>
<p class="calibre8"><strong class="calibre14">Z</strong>: To understand this option, consider a variable that contains RED`nGREEN`nBLUE`n. If the <strong class="calibre14">Z</strong> option is not present, the last linefeed (`n) is considered to be part of the last item, and thus there are only 3 items. But by specifying the Z option, the last linefeed (if present) will be considered to delimit a blank item at the end of the list, and thus there are 4 items (the last being blank).</p>
<p class="calibre8"><strong class="calibre14">\</strong> (backslash): Sorts items based on the substring that follows the last backslash in each. If an item has no backslash, the entire item is used as the substring. This option is useful for sorting bare filenames (i.e. excluding their paths). In the example below, the AAA.txt line is sorted above the BBB.txt line because their directories are ignored for the purpose of the sort:<br class="calibre12" /> C:\BBB\AAA.txt<br class="calibre12" /> C:\AAA\BBB.txt<br class="calibre12" /> Note: Options <strong class="calibre14">N</strong> and <strong class="calibre14">P</strong> are ignored when the backslash option is present. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is typically use to sort a variable that contains a list of lines, with each line ending in a linefeed (`n) character.</p>
<p class="calibre8">If <em class="calibre21">VarName</em> is clipboard and the clipboard contains files (such as those copied from an open Explorer window), those files will be replaced with a sorted list of their filenames. In other words, after the operation, the clipboard will no longer contain the files themselves.</p>
<p class="calibre8">If VarName is an <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable, </a>a script variable will be created to take its place. To put the sorted contents back into the environment variable and force the script to access it in the future, use this example:<br class="calibre12" /> VarSort, MyEnvVar<br class="calibre12" /> EnvSet, MyEnvVar, %MyEnvVar%<br class="calibre12" /> MyEnvVar = ; make the script's variable blank so that MyEnvVar will be retrieved from the environment in the future. </p>
<p class="calibre8">The maximum capacity of a variable can be increased via <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a>.</p>
<p class="calibre8">If a large variable was sorted and later its contents are no longer needed, you can free its memory by making it blank, e.g. MyVar = </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a>, <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a>, <a href="#Clipboard.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">clipboard</a>, <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">MyVar = 5,3,7,9,1,13,999,-4
Sort MyVar, N D, ; Sort numerically, use comma as delimiter.
MsgBox %MyVar% ; The result is -4,1,3,5,7,9,13,999
; This example makes Win+C a hotkey to copy files from an open
; Explorer window and put their sorted filenames onto the clipboard:
#c::
Clipboard = ; Must be blank for detection to work.
Send ^c
ClipWait 2
if ErrorLevel &lt;&gt; 0
return
Sort Clipboard
MsgBox Ready to be pasted:`n%Clipboard%
return</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="StringCaseSense.htm" href="#StringCaseSense.htm">#</a> <h2 class="calibre17">StringCaseSense</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Determines whether string comparisons are case sensitive (default = no). </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringCaseSense, On|Off</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">On|Off</td>
<td width="85%" class="calibre4">On: String comparisons are case sensitive.<br class="calibre12" /> Off: String comparisons are not case sensitive. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The command affects the behavior of <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual (and its family)</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a> and <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>.</p>
<p class="calibre8">If this command isn't used in a script, string comparisons are never case sensitive.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_StringCaseSense</strong> contains the current setting (On or Off).</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfEqual</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#IfBetween.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var between</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace, </a><a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">StringCaseSense, on </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="StringGetPos.htm" href="#StringGetPos.htm">#</a> <h2 class="calibre17">StringGetPos</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the position of the specified substring within a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringGetPos, OutputVar, InputVar, SearchText [, L#|R#] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved position. Position 0 is the first character. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">InputVar</td>
<td class="calibre4">The name of the input variable, whose contents will be searched. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SearchText</td>
<td class="calibre4">The text to search for. Matching is not case sensitive unless changed by <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">L#|R#</td>
<td class="calibre4">
<p class="calibre8">This affects which occurrence will be found if <em class="calibre21">SearchText</em> occurs more than once within <em class="calibre21">InputVar</em>. If this parameter is omitted, <em class="calibre21">InputVar</em> will be searched starting from the left for the first match. If this parameter is 1 or the letter R, the search will start looking at the right side of <em class="calibre21">InputVar</em> and will continue leftward until the first match is found.</p>
<p class="calibre8 tbd">In v1.0.09+, to find a match other than the first, specify the letter L or R followed by the number of the occurrence. For example, to find the fourth occurrence from the right, specify r4. Note: If the number is less than or equal to zero, no match will be found.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the specified occurrence of <em class="calibre21">SearchText</em> could not be found within <em class="calibre21">InputVar,</em> or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Unlike <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, 0 is defined as the position of the first character.</p>
<p class="calibre8">If the specified occurrence of <em class="calibre21">SearchText</em> does not exist within <em class="calibre21">InputVar</em>, <em class="calibre21">OutputVar</em> will be set to -1 and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to 1.</p>
<p class="calibre8">Use <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a> to more easily parse a file path into its directory, filename, and extension.</p>
<p class="calibre8">The built-in variables <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a> and <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Tab%</a> contain a single space and a single tab character, respectively, which is useful when searching for these characters alone or strings that begin or end with them.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#RegExGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegExGetPos</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var is type</a> </p>
<p class="calibre8">
<strong class="calibre14">Examples</strong>
</p>
<pre class="calibre22">Haystack = abcdefghijklmnopqrs
Needle = def
StringGetPos, pos, Haystack, %Needle%
if pos &gt;= 0
MsgBox, The string was found at position %pos%.
</pre>
<br class="calibre12" /> ; Example #2:<br class="calibre12" /> ; Divides up the full path name of a file into components.<br class="calibre12" /> ; Note that it would be much easier to use <a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a> or a<br class="calibre12" /> ; <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> to do this, so the below is just for illustration.<br class="calibre12" />
<pre class="calibre22">FileSelectFile, file, , , Pick a filename in a deeply nested folder:
if file &lt;&gt;
{
StringLen, pos_prev, file
pos_prev++ ; Adjust to be the position after the last char.
Loop
{
; Search from the right for the Nth occurrence:
<strong class="calibre14">StringGetPos</strong>, pos, file, \, R%a_index%
if ErrorLevel &lt;&gt; 0
break
length = %pos_prev%
length -= %pos%
length--
pos_prev = %pos%
pos += 2 ; Adjust for use with StringMid.
StringMid, path_component, file, %pos%, %length%
MsgBox Path component #%a_index% (from the right) is:`n%path_component%
}
}
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent x11">
<a id="RegExGetPos.htm" href="#RegExGetPos.htm">#</a> <h2 class="calibre17">RegExGetPos</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the position of the specified regular expression substring within a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">RegExGetPos, OutputVar, InputVar, SearchText [, L#|R#] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved position. Position 0 is the first character. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">InputVar</td>
<td class="calibre4">The name of the input variable, whose contents will be searched. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">RegExSearchText</td>
<td class="calibre4">The regular expression to search for. This is treated as a regular expression, meaning you can find a complex pattern with this. Matching is not case sensitive unless changed by <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">L#|R#</td>
<td class="calibre4">
<p class="calibre8">This affects which occurrence will be found if <em class="calibre21">RegExSearchText</em> occurs more than once within <em class="calibre21">InputVar</em>. If this parameter is omitted, <em class="calibre21">InputVar</em> will be searched starting from the left for the first match. If this parameter is 1 or the letter R, the search will start looking at the right side of <em class="calibre21">InputVar</em> and will continue leftward until the first match is found.</p>
<p class="calibre8 rm">In v1.0.09+, to find a match other than the first, specify the letter L or R followed by the number of the occurrence. For example, to find the fourth occurrence from the right, specify r4. Note: If the number is less than or equal to zero, no match will be found.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the specified occurrence of <em class="calibre21">RegExSearchText</em> could not be found within <em class="calibre21">InputVar,</em> or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Unlike <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, 0 is defined as the position of the first character.</p>
<p class="calibre8">If the specified occurrence of <em class="calibre21">RegExSearchText</em> does not exist within <em class="calibre21">InputVar</em>, <em class="calibre21">OutputVar</em> will be set to -1 and <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to 1.</p>
<p class="calibre8">Use <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a> to more easily parse a file path into its directory, filename, and extension.</p>
<p class="calibre8">The built-in variables <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a> and <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Tab%</a> contain a single space and a single tab character, respectively, which is useful when searching for these characters alone or strings that begin or end with them.</p>
<p class="calibre8"> </p>
<p class="calibre8">
<strong class="calibre14">Examples</strong>
</p>
<pre class="calibre22">Haystack = abc4defghijklmnopqrs
Needle = [0-9]
RegExGetPos, pos, Haystack, %Needle%
if pos &gt;= 0
MsgBox, A number was found at position %pos%.
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="StringLeft.htm" href="#StringLeft.htm">#</a> <h2 class="calibre17">StringLeft / StringRight</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves a number of characters from the left or right hand side of a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringLeft, OutputVar, InputVar, Count<br class="calibre12" /> StringRight, OutputVar, InputVar, Count</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the substring extracted from <em class="calibre21">InputVar</em>. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">InputVar</td>
<td width="85%" class="calibre4">The name of the variable whose contents will be extracted from. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Count</td>
<td class="calibre4">The number of characters to extract. If <em class="calibre21">Count</em> is less than or equal to zero, <em class="calibre21">OutputVar</em> will be made empty (blank). If <em class="calibre21">Count</em> exceeds the length of <em class="calibre21">InputVar</em>, <em class="calibre21">OutputVar</em> will be set equal to the entirety of <em class="calibre21">InputVar</em>.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">For this and all other commands, <em class="calibre21">O</em><em class="calibre21">utputVar</em> is allowed to be the same variable as an <em class="calibre21">InputVar</em>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">String = This is a test. <br class="calibre12" /> StringLeft, OutputVar, String, 4 ; Stores the string "This" in OutputVar. <br class="calibre12" /> StringRight, OutputVar, InputVar, 5 ; Stores the string "test." in OutputVar. <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="StringLen.htm" href="#StringLen.htm">#</a> <h2 class="calibre17">StringLen</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the count of how many characters are in a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringLen, OutputVar, InputVar</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the length. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">InputVar</td>
<td width="85%" class="calibre4">The name of the variable whose contents will be measured. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> StringLen, length, InputVar<br class="calibre12" /> MsgBox, The length is %length%.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="StringLower.htm" href="#StringLower.htm">#</a> <h2 class="calibre17">StringLower / StringUpper</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Converts a string to lowercase or uppercase.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringLower, OutputVar, InputVar [, T] <br class="calibre12" /> StringUpper, OutputVar, InputVar [, T] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store newly converted string.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">InputVar</td>
<td width="85%" class="calibre4">The name of the variable whose contents will be read from. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">T</td>
<td class="calibre4">If this parameter is the letter T, the string will be converted to title case. For example, "GONE with the WIND" would become "Gone With The Wind". </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To detect whether a character or string is entirely uppercase or lowercase, use <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">"if var is [not] upper/lower</a>".</p>
<p class="calibre8">For this and all other commands, <em class="calibre21">O</em><em class="calibre21">utputVar</em> is allowed to be the same variable as an <em class="calibre21">InputVar</em>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> StringUpper, String1, String1 ; i.e. output can be the same as input.<br class="calibre12" /> StringLower, String2, String2</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="StringMid.htm" href="#StringMid.htm">#</a> <h2 class="calibre17">StringMid</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves a number of characters from the specified position in a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringMid, OutputVar, InputVar, StartChar, Count <span class="tbd">[, L]</span> </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the substring extracted from <em class="calibre21">InputVar</em>. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">InputVar</td>
<td width="85%" class="calibre4">The name of the variable whose contents will be extracted from. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">StartChar</td>
<td class="calibre4">The position of the first character to be extracted. Unlike <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, 1 is the first character. If StartChar is less than 1, it will be assumed to be 1. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Count</td>
<td class="calibre4">The number of characters to extract. If count is less than or equal to zero, <em class="calibre21">OutputVar</em> will be made empty (blank). If count exceeds the length of <em class="calibre21">InputVar</em> measured from <em class="calibre21">StartChar</em>, <em class="calibre21">OutputVar</em> will be set equal to the entirety of <em class="calibre21">InputVar</em> starting at <em class="calibre21">StartChar</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">L</td>
<td class="calibre4 tbd">
<p class="calibre8">In v1.0.15+, the letter L can be used to extract characters from the left of <em class="calibre21">StartChar</em> rather than from the right. In this example, <em class="calibre21">OutputVar</em> will be set to <em class="calibre21">Red</em>:<br class="calibre12" /> InputVar = The Red Fox<br class="calibre12" /> StringMid, OutputVar, InputVar, 7, 3, L</p>
<p class="calibre8">If the L option is present and <em class="calibre21">StartChar </em>is less than 1, <em class="calibre21">OutputVar</em> will be made blank. If <em class="calibre21">StartChar</em> is beyond the length of <em class="calibre21">InputVar</em>, only those characters within reach of <em class="calibre21">Count</em> will be extracted. For example, the below will set <em class="calibre21">OutputVar</em> to <em class="calibre21">Fox</em>:<br class="calibre12" /> InputVar = The Red Fox<br class="calibre12" /> StringMid, OutputVar, InputVar, 14, 6, L</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">For this and all other commands, <em class="calibre21">O</em><em class="calibre21">utputVar</em> is allowed to be the same variable as an <em class="calibre21">InputVar</em>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Source = Hello this is a test. <br class="calibre12" /> StringMid, the_word_this, Source, 7, 4 <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="StringReplace.htm" href="#StringReplace.htm">#</a> <h2 class="calibre17">StringReplace</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Replaces the specified substring with a new string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the result of the replacement process. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">InputVar</td>
<td class="calibre4">The name of the variable whose contents will be read from. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SearchText</td>
<td class="calibre4">The text to search for. Matching is not case sensitive unless changed by <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">ReplaceText</td>
<td width="85%" class="calibre4"><em class="calibre21">SearchText</em> will be replaced with this text. If omitted or blank, <em class="calibre21">SearchText</em> will be replaced with blank (empty). In other words, it will be omitted from <em class="calibre21">OutputVar</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ReplaceAll?</td>
<td class="calibre4">If omitted, only the first occurrence of <em class="calibre21">SearchText</em> will be replaced. But if this parameter is 1, A, or All, all occurrences will be replaced. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if <em class="calibre21">SearchText</em> could not be found within <em class="calibre21">InputVar,</em> or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">For this and all other commands, <em class="calibre21">O</em><em class="calibre21">utputVar</em> is allowed to be the same variable as an <em class="calibre21">InputVar</em>.</p>
<p class="calibre8">The built-in variables <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a> and <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Tab%</a> contain a single space and a single tab character, respectively, which might be useful when searching for these characters alone.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#RegExReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RegExReplace</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#IfIs.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">if var is type</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8"> ; Remove all CR+LF's from the clipboard contents:<br class="calibre12" /> StringReplace, clipboard, clipboard, `r`n, , all</p>
<p class="calibre8">; Replace all spaces with pluses:<br class="calibre12" /> StringReplace, NewStr, OldStr, %A_SPACE%, +, all<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain x11">
<div class="calibreEbookContent">
<a id="RegExReplace.htm" href="#RegExReplace.htm">#</a> <h2 class="calibre17">RegExReplace</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Replaces the specified regular expression substring with a new string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">RegExReplace, OutputVar, InputVar, RegExSearchText [, ReplaceText, ReplaceAll?] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the result of the replacement process. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">InputVar</td>
<td class="calibre4">The name of the variable whose contents will be read from. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">RegExSearchText</td>
<td class="calibre4">The text to search for. This is treated as a regular expression, meaning you can capture complex pattern with this. Matching is not case sensitive unless changed by <a href="#StringCaseSense.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringCaseSense</a>.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">ReplaceText</td>
<td width="85%" class="calibre4"><em class="calibre21">RegExSearchText</em> will be replaced with this text. If omitted or blank, <em class="calibre21">RegExSearchText</em> will be replaced with blank (empty). In other words, it will be omitted from <em class="calibre21">OutputVar</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ReplaceAll?</td>
<td class="calibre4">If omitted, only the first occurrence of <em class="calibre21">RegExSearchText</em> will be replaced. But if this parameter is 1, A, or All, all occurrences will be replaced. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if <em class="calibre21">RegExSearchText</em> could not be found within <em class="calibre21">InputVar,</em> or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">For this and all other commands, <em class="calibre21">O</em><em class="calibre21">utputVar</em> is allowed to be the same variable as an <em class="calibre21">InputVar</em>.</p>
<p class="calibre8">The built-in variables <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Space%</a> and <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">%A_Tab%</a> contain a single space and a single tab character, respectively, which might be useful when searching for these characters alone.</p>
<p class="calibre8"> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">; Replace all number sections with single underscores:<br class="calibre12" /> RegExReplace, NewStr, OldStr, [0-9]+, _, all<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="StringSplit.htm" href="#StringSplit.htm">#</a> <h2 class="calibre17">StringSplit</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Separates a string into an array of substrings using the specified delimiters.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringSplit, OutputArray, InputVar [, Delimiters, OmitChars, FutureUse]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputArray</td>
<td class="calibre4">The name of the <a href="#Arrays.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">array</a> in which to store each substring extracted from <em class="calibre21">InputVar</em>. For example, if MyArray is specified, the command will put the number of substrings produced (0 if none) into MyArray0, the 1st substring into MyArray1, the 2nd into MyArray2, and so on.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">InputVar</td>
<td width="85%" class="calibre4">The name of the variable whose contents will be analyzed. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Delimiters</td>
<td class="calibre4">
<p class="calibre8">If this parameter is blank or omitted, each character of <em class="calibre21">InputVar</em> will be treated as a separate substring.</p>
<p class="calibre8">Otherwise, <em class="calibre21">Delimiters</em> contains one or more characters (case sensitive) used to determine where the boundaries between substrings occur in <em class="calibre21">InputVar</em>. Since the delimiter characters are not considered to be part of the substrings themselves, they are never copied into <em class="calibre21">OutputArray</em>. If there is nothing between a pair of delimiters within <em class="calibre21">InputVar</em>, the corresponding array element will be blank.</p>
<p class="calibre8">For example: `, (an escaped comma) would divide the string based on every occurrence of a comma. Similarly, %A_Tab%%A_Space% would create a new array element every time a space or tab is encountered in <em class="calibre21">InputVar</em>.</p>
<p class="calibre8">To use a string as a delimiter rather than a character, first use <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a> to replace all occurrences of the string with a single character that is never used literally in the text. Consider this example, which uses the string &lt;br&gt; as a delimiter:<br class="calibre12" /> StringReplace, NewHTML, HTMLString, &lt;br&gt;, ``, All ; Replace each &lt;br&gt; with an accent. <br class="calibre12" /> StringSplit, MyArray, NewHTML, `` ; Split the string based on the accent character. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">OmitChars</td>
<td class="calibre4">
<p class="calibre8">An optional list of characters (case sensitive) to exclude from the beginning and end of each array element. For example, if <em class="calibre21">OmitChars</em> is %A_Space%%A_Tab%, spaces and tabs will be removed from the beginning and end (but not the middle) of every element.</p>
<p class="calibre8">If <em class="calibre21">Delimiters</em> is blank, <em class="calibre21">OmitChars</em> indicates which characters should be excluded from the array. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">FutureUse</td>
<td class="calibre4">This parameter should be always left blank (omitted).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If the array elements already exist, the command will change the values of only the first N elements, where N is the number of substrings present in <em class="calibre21">InputVar</em>. Any elements beyond N that existed beforehand will be unchanged. Therefore, its safest to use the zero element (MyArray0) to determine how many items were actually produced by the command.</p>
<p class="calibre8">Whitespace characters such as spaces and tabs will be preserved unless those characters are themselves delimiters. Tabs and spaces can be trimmed from both ends of any variable by assigning it to itself while <a href="#AutoTrim.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">AutoTrim</a> is off (the default). For example: MyArray1 = %MyArray1%</p>
<p class="calibre8">To split a string that is in standard CSV (comma separated value) format, use a <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> since it has built-in CSV handling.</p>
<p class="calibre8">If you do not need the substrings to be permanently stored in memory, consider using a <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> (especially if <em class="calibre21">InputVar</em> is very large, in which case a large amount of memory would be saved).</p>
<p class="calibre8">To arrange the fields in a different order prior to splitting them, use the <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a> command. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Parsing loop</a>, <a href="#Arrays.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Arrays</a>, <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a>, <a href="#SplitPath.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplitPath</a>, <a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a>, <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimRight</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">TestString = This is a test.
StringSplit, word_array, TestString, %A_Space%, . ; Omits periods.
MsgBox, The 4th word is %word_array4%.
Colors = red,green,blue
StringSplit, ColorArray, Colors, `,
Loop, %ColorArray0%
{
StringTrimLeft, this_color, ColorArray%a_index%, 0
MsgBox, Color number %a_index% is %this_color%.
}</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="StringTrimLeft.htm" href="#StringTrimLeft.htm">#</a> <h2 class="calibre17">StringTrimLeft / StringTrimRight</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Removes a number of characters from the left or right hand side of a string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StringTrimLeft, OutputVar, InputVar, Count<br class="calibre12" /> StringTrimRight, OutputVar, InputVar, Count</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the shortened version of <em class="calibre21">InputVar</em>.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">InputVar</td>
<td width="85%" class="calibre4">The name of the variable whose contents will be read from. Do not enclose the name in percent signs unless you want the <em class="calibre21">contents</em> of the variable to be used as the name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Count</td>
<td class="calibre4">The number of characters to remove. If <em class="calibre21">Count</em> is less than or equal to zero, <em class="calibre21">OutputVar</em> will be set equal to the entirety of <em class="calibre21">InputVar</em>. If <em class="calibre21">Count</em> exceeds the length of <em class="calibre21">InputVar</em>, <em class="calibre21">OutputVar</em> will be made empty (blank).</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">For this and all other commands, <em class="calibre21">O</em><em class="calibre21">utputVar</em> is allowed to be the same variable as an <em class="calibre21">InputVar</em>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#IfInString.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfInString</a>, <a href="#StringGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringGetPos</a>, <a href="#StringMid.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringMid</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLeft</a>, <a href="#StringLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringRight</a>, <a href="#StringLen.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLen</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringLower</a>, <a href="#StringLower.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringUpper</a>, <a href="#StringReplace.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringReplace</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">String = This is a test.<br class="calibre12" /> StringTrimLeft, OutputVar, String, 5 ; Stores the string "is a test." in OutputVar.<br class="calibre12" /> StringTrimRight, OutputVar, String, 6 ; Stores the string "This is a" in OutputVar.<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="Control.htm" href="#Control.htm">#</a> <h2 class="calibre17">Control</h2> [v1.0.09+]
<hr size="2" class="calibre24" />
<p class="calibre8">Makes a variety of changes to a control.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">Control, Cmd [, Value, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Cmd, Value </td>
<td class="calibre4">
<p class="calibre8">The <em class="calibre21">Cmd</em> and <em class="calibre21">Value</em> parameters are dependent upon each other and their usage is described below.</p>
<p class="calibre8"><strong class="calibre14">Check</strong>: Turns on (checks) a radio button or checkbox.</p>
<p class="calibre8"><strong class="calibre14">Uncheck</strong>: Turns off a radio button or checkbox. </p>
<p class="calibre8"><strong class="calibre14">Enable</strong>: Enables a control if it was previously disabled.</p>
<p class="calibre8"><strong class="calibre14">Disable</strong>: Disables or "grays out" a control. </p>
<p class="calibre8"><strong class="calibre14">Show</strong>: Shows a control if it was previously hidden. </p>
<p class="calibre8"><strong class="calibre14">Hide</strong>: Hides a control. </p>
<p class="calibre8"><strong class="calibre14">ShowDropDown</strong>: Drops a ComboBox so that its choices become visible. </p>
<p class="calibre8"><strong class="calibre14">HideDropDown</strong>: Reverses the above. </p>
<p class="calibre8"><strong class="calibre14">TabLeft [, Count]</strong>: Moves left by one or more tabs in a SysTabControl32. <em class="calibre21">Count</em> is assumed to be 1 if omitted or blank. </p>
<p class="calibre8"><strong class="calibre14">TabRight [, Count]</strong>: Moves right by one or more tabs in a SysTabControl32. <em class="calibre21" /><em class="calibre21">Count</em> is assumed to be 1 if omitted or blank.</p>
<p class="calibre8"><strong class="calibre14">Add, String</strong>: Adds <em class="calibre21">String</em> as a new entry at the bottom of a ListBox or ComboBox.</p>
<p class="calibre8"><strong class="calibre14">Delete, N</strong>: Deletes the Nth entry from a ListBox or ComboBox. <em class="calibre21">N</em> should be 1 for the first entry, 2 for the second, etc. </p>
<p class="calibre8"><strong class="calibre14">Choose, N</strong>: Sets the selection in a ListBox or ComboBox to be the Nth entry. <em class="calibre21">N</em> should be 1 for the first entry, 2 for the second, etc.</p>
<p class="calibre8"><strong class="calibre14">ChooseString, String</strong>: Sets the selection (choice) in a ListBox or ComboBox to be the entry whose leading part matches <em class="calibre21">String</em>. The search is not case sensitive. For example, if a ListBox/ComboBox contains the item "UNIX Text", specifying the word unix (lowercase) would be enough to select it.</p>
<p class="calibre8"><strong class="calibre14">EditPaste, String</strong>: Pastes <em class="calibre21">String</em> at the caret/insert position in an Edit control.</p>
</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Control</td>
<td width="85%" class="calibre4">Can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. If this parameter is blank, the target window's topmost control will be used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 of there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To improve reliability, a delay is done automatically after every use of this command. That delay can be changed via <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>.</p>
<p class="calibre8">To discover the name of the control that the mouse is currently hovering over, use <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#GuiControl.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControl</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> Control, HideDropDown, , ComboBox1, Some Window Title<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ControlFocus.htm" href="#ControlFocus.htm">#</a> <h2 class="calibre17">ControlFocus</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets input focus to a given control on a window. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlFocus [, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">Control</td>
<td class="calibre4">Can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. If this parameter is blank or omitted, the target window's topmost control will be used.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To improve reliability, a delay is done automatically after every use of this command. That delay can be changed via <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>.</p>
<p class="calibre8">To discover the name of the control that the mouse is currently hovering over, use <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#ControlGetFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetFocus</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> ControlFocus, OK, Some Window Title ; Set focus to the OK button<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ControlGet.htm" href="#ControlGet.htm">#</a> <h2 class="calibre17">ControlGet</h2> [v1.0.09+]
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves various types of information about a control. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlGet, OutputVar, Cmd [, Value, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the result of <em class="calibre21">Cmd</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Cmd, Value </td>
<td class="calibre4">See list below. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Control</td>
<td width="85%" class="calibre4">Can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. If this parameter is blank, the target window's topmost control will be used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14"><u class="calibre20">Cmd, Value</u></strong></p>
<p class="calibre8">The <em class="calibre21">Cmd</em> and <em class="calibre21">Value</em> parameters are dependent upon each other and their usage is described below. If a problem is encountered -- such as a non-existent window or control -- <em class="calibre21">OutputVar</em> is made blank and ErrorLevel is set to 1. </p>
<p class="calibre8"><strong class="calibre14">Checked</strong>: Sets <em class="calibre21">OutputVar</em> to be 1 if the checkbox or radio button is checked or 0 if not.</p>
<p class="calibre8"><strong class="calibre14">Enabled</strong>: Sets <em class="calibre21">OutputVar</em> to be 1 if <em class="calibre21">Control</em> is enabled, or 0 if disabled.</p>
<p class="calibre8"><strong class="calibre14">Visible</strong>: Sets <em class="calibre21">OutputVar</em> to be 1 if <em class="calibre21">Control</em> is visible, or 0 if hidden.</p>
<p class="calibre8"><strong class="calibre14">Tab</strong>: Sets <em class="calibre21">OutputVar</em> to the tab number of a SysTabControl32 control. The first tab is 1, the second is 2, etc. </p>
<p class="calibre8"><strong class="calibre14">FindString, String </strong>: Sets <em class="calibre21">OutputVar</em> to the entry number of a ListBox or ComboBox that is an exact match for <em class="calibre21">String</em>. The first entry in the control is 1, the second 2, and so on. If no match is found, <em class="calibre21">OutputVar</em> is made blank and ErrorLevel is set to 1. </p>
<p class="calibre8"><strong class="calibre14">Choice</strong>: Sets <em class="calibre21">OutputVar</em> to be the name of the currently selected entry in a ListBox or ComboBox. To instead retrieve the position of the selected item, follow this example (use only one of the first two lines):<br class="calibre12" />
<a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SendMessage</a>, 0x188, 0, 0, ListBox1, WinTitle ; 0x188 is LB_GETCURSEL (for a ListBox). <br class="calibre12" />
<a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SendMessage</a>, 0x147, 0, 0, ComboBox1, WinTitle ; 0x147 is CB_GETCURSEL (for a DropDownList or ComboBox).<br class="calibre12" /> ChoicePos = %ErrorLevel%<br class="calibre12" /> ChoicePos += 1; Convert from 0-based to 1-based, i.e. so that the first item is known as 1 not 0.
</p>
<p class="calibre8"><strong class="calibre14">LineCount</strong>: Sets <em class="calibre21">OutputVar</em> to be the number of lines in an Edit control. All Edit controls have at least 1 line, even if the control is empty. </p>
<p class="calibre8"><strong class="calibre14">CurrentLine</strong>: Sets <em class="calibre21">OutputVar</em> to be the line number in an Edit control where the caret (insert point) resides. The first line is 1. If there is text selected in the control, <em class="calibre21">OutputVar</em> is set to the line number where the selection begins.</p>
<p class="calibre8"><strong class="calibre14">CurrentCol</strong>: Sets <em class="calibre21">OutputVar</em> to be the column number in an Edit control where the caret (insert point) resides. The first column is 1. If there is text selected in the control, <em class="calibre21">OutputVar</em> is set to the column number where the selection begins.</p>
<p class="calibre8"><strong class="calibre14">Line, N</strong>: Sets <em class="calibre21">OutputVar</em> to be the text of line <em class="calibre21">N</em> in an Edit control. Line 1 is the first line. Depending on the nature of the control, <em class="calibre21">OutputVar</em> might end in a carriage return (`r) or a carriage return + linefeed (`r`n).</p>
<p class="calibre8"><strong class="calibre14">Selected</strong>: Sets <em class="calibre21">OutputVar</em> to be the selected text in an Edit control. If no text is selected, OutputVar will be made blank and ErrorLevel will be set to 0 (i.e. no error). Certain types of controls, such as RichEdit20A, might not produce the correct text in some cases (e.g. Metapad).</p>
<p class="calibre8"><strong class="calibre14">Style</strong> [v1.0.21+]: Retrieves an 8-digit hexadecimal number representing the style of the control. See <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> for details about style.</p>
<p class="calibre8"><strong class="calibre14">ExStyle</strong> [v1.0.21+]: Retrieves an 8-digit hexadecimal number representing the extended style of the control. See <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> for details about extended style. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 of there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Unlike commands that change a control, ControlGet does not have an automatic delay (<a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a> does not affect it).</p>
<p class="calibre8">To discover the name of the control that the mouse is currently hovering over, use <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>. </p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#GuiControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GuiControlGet</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">ControlGet, OutputVar, Line, 1, Edit1, Some Window Title
ControlGet, WhichTab, Tab, , SysTabControl321, Some Window Title
if ErrorLevel &lt;&gt; 0
MsgBox There was a problem.
else
MsgBox Tab #%WhichTab% is active.
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ControlGetFocus.htm" href="#ControlGetFocus.htm">#</a> <h2 class="calibre17">ControlGetFocus</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves which control of the target window has input focus, if any.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlGetFocus, OutputVar [WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of the variable in which to store the identifier of the control, which consists of its classname followed by its sequence number within its parent window, e.g. Button12. </p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"> <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 0 if the control with input focus was successfully retrieved. Otherwise (e.g. the target window doesn't exist or none of its controls have input focus) it will be set to 1.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The control retrieved by this command is the one that has keyboard focus, that is, the one that would receive keystrokes if the user were to type any.</p>
<p class="calibre8">The target window must be active to have a focused control. If the window is not active, <em class="calibre21">OutputVar</em> will be made blank.</p>
<p class="calibre8">If ControlFocus is executed repeatedly at a high frequency (i.e. every 500 ms or faster), it will probably disrupt the user's ability to double-click. There is no known workaround.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">ControlGetFocus, OutputVar, Untitled - Notepad
if ErrorLevel = 0
MsgBox, Control with focus = %OutputVar%
else
MsgBox, The target window doesn't exist or none of its controls has input focus.
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ControlGetPos.htm" href="#ControlGetPos.htm">#</a> <h2 class="calibre17">ControlGetPos</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the position and size of a control.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlGetPos [, X, Y, Width, Height, Control, WinTitle, WinText, ExcludeTitle, ExcludeText] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">X, Y</td>
<td class="calibre4">
<p class="calibre8">The names of the variables in which to store the X and Y coordinates of <em class="calibre21">Control</em>'s upper left corner. These coordinates are relative to the target window and thus are the same as those used by <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>.</p>
<p class="calibre8">If either X or Y is omitted, the corresponding values will not be stored. </p>
</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Width/Height</td>
<td width="85%" class="calibre4">The names of the variables in which to store <em class="calibre21">Control</em>'s width and height. If omitted, the corresponding values will not be stored.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Control</td>
<td class="calibre4">Can be either ClassNN (the classname and instance number of the control) (<span class="x11">recommended</span>) or the name/text of the control (<span class="x11">can be slow</span>), both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. <span class="tbd">If this parameter is blank, the target window's topmost control will be used.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="x11">This command relies on accessibility support. <a href="#Accessibility.htm">Please read this section</a> to avoid problems.</p>
<p class="calibre8">If no matching window or control is found, the output variables will be made blank.</p>
<p class="calibre8">Unlike commands that change a control, ControlGetPos does not have an automatic delay (<a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a> does not affect it).</p>
<p class="calibre8">To discover the name of the control that the mouse is currently hovering over, use <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>. To retrieve a list of all controls in a window, use <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">; This working example will continuously update and display the
; name and position of the control currently under the mouse cursor:
Loop
{
Sleep, 100
MouseGetPos, , , WhichWindow, WhichControl
ControlGetPos, x, y, w, h, %WhichControl%, ahk_id %WhichWindow%
ToolTip, %WhichControl%`nX%X%`tY%Y%`nW%W%`t%H%
}
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ControlGetText.htm" href="#ControlGetText.htm">#</a> <h2 class="calibre17">ControlGetText</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves text from a control. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlGetText, OutputVar [, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">
<p class="calibre8">The name of the variable in which to store the retrieved text.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Control</td>
<td class="calibre4">Can be either ClassNN (the classname and instance number of the control (<span class="x11">recommended</span>)) or the name/text of the control (<span class="x11">can be slow</span>), both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. <span class="tbd">If this parameter is blank or omitted, the target window's topmost control will be used.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="x11">This command relies on accessibility support. <a href="#Accessibility.htm">Please read this section</a> to avoid problems.</p>
<p class="calibre8 tbd">The amount of text retrieved is limited to a variable's maximum capacity (which can be changed via the <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a> directive). As a result, this command might use a large amount RAM if the target control (e.g. an editor with a large document open) contains a large quantity of text. However, a variable's memory can be freed after use by assigning it to nothing, i.e. OutputVar =</p>
<p class="calibre8">To retrieve a list of all controls in a window, use <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>, <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> ControlGetText, OutputVar, Edit1, Untitled -<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ControlMove.htm" href="#ControlMove.htm">#</a> <h2 class="calibre17">ControlMove</h2> [v1.0.09+]
<hr size="2" class="calibre24" />
<p class="calibre8">Moves or resizes a control. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlMove, Control, X, Y, Width, Height [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Control</td>
<td width="85%" class="calibre4">Can be either ClassNN (the classname and instance number of the control) or the name/text of the control, both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. If this parameter is blank, the target window's topmost control will be used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X, Y </td>
<td class="calibre4">The X and Y coordinates of the upper left corner of <em class="calibre21">Control</em>'s new location. If either coordinate is blank or omitted, <em class="calibre21">Control</em>'s position in that dimension will not be changed. The coordinates are relative to <em class="calibre21">Control</em>'s parent window; <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a> or Window Spy can be used to determine them.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Width, Height</td>
<td class="calibre4">The new size of <em class="calibre21">Control</em>. If either parameter is blank or omitted, <em class="calibre21">Control</em>'s size in that dimension will not be changed.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To improve reliability, a delay is done automatically after every use of this command. That delay can be changed via <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">SetTimer, ControlMoveTimer
InputBox, OutputVar, My Input Box
return
ControlMoveTimer:
IfWinNotExist, My Input Box, , return
; Otherwise the above set the "last found" window for us:
SetTimer, ControlMoveTimer, off
WinActivate
<strong class="calibre14">ControlMove, OK, 10, , 200</strong> ; Move the OK button to the left and increase its width.
return</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ControlSetText.htm" href="#ControlSetText.htm">#</a> <h2 class="calibre17">ControlSetText</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the text of a control. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">ControlSetText, Control, NewText [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Control</td>
<td width="85%" class="calibre4">Can be either ClassNN (the classname and instance number of the control (<span class="x11">recommended</span>)) or the name/text of the control (<span class="x11">can be slow</span>), both of which can be determined via Window Spy. When using name/text, the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>. <span class="tbd">If this parameter is blank, the target window's topmost control will be used.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">NewText</td>
<td class="calibre4">The new text to set into the control. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="x11">This command relies on accessibility support. <a href="#Accessibility.htm">Please read this section</a> to avoid problems.</p>
<p class="calibre8 tbd">To improve reliability, a delay is done automatically after every use of this command. That delay can be changed via <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#ControlGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGet</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> ControlSetText, Edit1, New Text Here, Untitled -<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain rm">
<div class="calibreEbookContent">
<a id="PostMessage.htm" href="#PostMessage.htm">#</a> <h2 class="calibre17">PostMessage / SendMessage</h2> [v1.0.08+]
<hr size="2" class="calibre24" />
<p class="calibre8">Sends a message to a window or control (SendMessage additionally waits for acknowledgement).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">PostMessage, Msg [, wParam, lParam, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]<br class="calibre12" /> SendMessage, Msg [, wParam, lParam, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetControlDelay.htm" href="#SetControlDelay.htm">#</a> <h2 class="calibre17">SetControlDelay</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the delay that will occur after each Control-modifying command.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetControlDelay, Delay </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Delay</td>
<td width="85%" class="calibre4">Time in milliseconds. Use -1 for no delay at all and 0 for the smallest possible delay. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A short delay (sleep) is automatically and invisibly done after every Control command that changes a control, namely <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, and <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a> (<a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a> uses <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>). This is done to improve the reliability of scripts because a control sometimes needs a period of "rest" after being changed by one of these commands. The rest period allows it to update itself and respond to the next command that the script may attempt to send to it.</p>
<p class="calibre8">Although a delay of -1 (no delay at all) is allowed, it is recommended that at least 0 be used, to increase confidence that the script will run correctly even when the CPU is under load.</p>
<p class="calibre8">A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all.</p>
<p class="calibre8">If the CPU is slow or under load, or if window animation is enabled, higher delay values may be needed.</p>
<p class="calibre8">If unset, the default delay is 20.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_ControlDelay</strong> contains the current setting.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#ControlClick.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlClick</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#ControlSetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSetText</a>, <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>,<a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> SetMouseDelay</a>, <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetControlDelay, 0 </p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinMenuSelectItem.htm" href="#WinMenuSelectItem.htm">#</a> <h2 class="calibre17">WinMenuSelectItem</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Invokes a menu item from the menu bar of a window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinMenuSelectItem, WinTitle, WinText, Menu [, SubMenu1, SubMenu2, SubMenu3, SubMenu4, SubMenu5, SubMenu6, ExcludeTitle, ExcludeText] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the other 3 window parameters are blank or omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">Menu</td>
<td class="calibre4">The name of the top-level menu, e.g. File, Edit, View. It can also be the position of the desired menu item by using 1&amp; to represent the first menu, 2&amp; the second, and so on. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">SubMenu1</td>
<td class="calibre4">The name of the menu item to select or its position (see above).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SubMenu2</td>
<td class="calibre4">If <em class="calibre21">SubMenu1</em> itself contains a menu, this is the name of the menu item inside, or its position.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SubMenu3</td>
<td class="calibre4">Same as above. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">SubMenu4</td>
<td class="calibre4">Same as above.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SubMenu5</td>
<td class="calibre4">Same as above.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">SubMenu6</td>
<td class="calibre4">Same as above.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">For this command to work, the target window need not be active. However, some windows might need to be in a <a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">non-minimized</a> state.</p>
<p class="calibre8">This command <strong class="calibre14">will not work</strong> with applications that use non-standard menu bars. Examples include Microsoft Outlook and Outlook Express, which use disguised toolbars for their menu bars. In these cases, consider using <a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a> or <a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PostMessage</a> , which should be able to interact with some of these non-standard menu bars.</p>
<p class="calibre8">The menu name parameters are not case sensitive (i.e. File-&gt;Save is the same as file-&gt;save) and the use of ampersand (&amp;) to indicate the underlined letter in a menu item is not necessary (i.e. &amp;File is the same as File).</p>
<p class="calibre8">The menu name parameters can also specify positions. This method exists to support menus that don't contain text (perhaps because they contain pictures of text rather than actual text). Position 1&amp; is the first menu item (e.g. the File menu), position 2&amp; is the second menu item (e.g. the Edit menu), and so on. Menu separator lines count as menu items for the purpose of determining the position of a menu item.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>, <a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PostMessage</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> ; This will select File-&gt;Open in Notepad: <br class="calibre12" /> WinMenuSelectItem, Untitled - Notepad, , File, Open</p>
<p class="calibre8">; Same as above except it's done by position vs. name:<br class="calibre12" /> WinMenuSelectItem, Untitled - Notepad, , 1&amp;, 2&amp;</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="GroupActivate.htm" href="#GroupActivate.htm">#</a> <h2 class="calibre17">GroupActivate</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Activates the next window in a window group that was defined with <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GroupActivate, GroupName [, R]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">GroupName</td>
<td width="85%" class="calibre4">The name of the group to activate, as originally defined by <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">R</td>
<td class="calibre4">This determines whether the oldest or the newest window is activated whenever no members of the group are currently active. If omitted, the oldest window is always activated. If it's the letter R, the newest window (the one most recently active) is activated, but only if no members of the group are active when the command is given. "R" is useful in cases where you temporarily switch to working on an unrelated task. When you return to the group via <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>, or <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a>, the window you were most recently working with is activated rather than the oldest window.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command causes the first window that matches any of the group's window specifications to be activated. Using it a second time will activate the next window in the series and so on. Normally, it is assigned to a hotkey so that this window-traversal behavior is automated by pressing that key.</p>
<p class="calibre8">When a window is activated immediately after another window was activated, task bar buttons may start flashing on some systems (depending on OS and settings). To prevent this, use <a href="#h_WinActivateForce.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#WinActivateForce</a>.</p>
<p class="calibre8">See <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a> for more details about window groups.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>, <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>, <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a>, <a href="#h_WinActivateForce.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#WinActivateForce</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">GroupActivate, MyGroup, R</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="GroupAdd.htm" href="#GroupAdd.htm">#</a> <h2 class="calibre17">GroupAdd</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Adds a window specification to a window group, creating the group if necessary.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GroupAdd, GroupName, WinTitle [, WinText, Label, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">GroupName</td>
<td width="85%" class="calibre4">The name of the group to which to add this window specification. If the group doesn't exist, it will be created. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">
<p class="calibre8">The title or partial title of the target window. It can be blank. <strong class="calibre14">Note</strong>: Although <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a> and <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> do not directly affect the behavior of this command, they do affect the behavior of commands such as <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> and <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a>.</p>
<p class="calibre8">To use a window class, specify ahk_class ExactClassName (shown by Window Spy). The use of a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a> is <u class="calibre20">not</u> currently supported.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON at the time that <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>, and <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a> are used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Label</td>
<td class="calibre4">The label of a subroutine to run if no windows matching this specification exist when the <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> command is used. The label is jumped to as though a <a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gosub</a> had been used. Omit or leave blank for none. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A window group is typically used to bind together a collection of related windows. Once defined, the <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> command is typically used to traverse the group (visit each member window, one at a time).</p>
<p class="calibre8">Groups are useful for tasks that involve many related windows, or an application that owns many subwindows. For example, if you frequently work with many instances (windows) of a graphics program or text editor, you can use a window group to rapidly visit each instance of that program without having to use alt-tab or task bar buttons to locate them.</p>
<p class="calibre8">Since the entries in each group need to be added only once, this command is typically used in the auto-execute section of the script (the part at the top that occurs prior to the first <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> label). Attempts to add duplicate entries to a group are ignored.</p>
<p class="calibre8">To include <u class="calibre20">all</u> windows in a group (except the special Program Manager window), use this example:<br class="calibre12" /> GroupAdd, All, , , , Program Manager</p>
<p class="calibre8"> </p>
<p class="calibre8"> <strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>, <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<p class="calibre8">; In the autoexecute section at the top of the script: <br class="calibre12" /> GroupAdd, MSIE, ahk_class IEFrame ; Add only Internet Explorer windows to this group.<br class="calibre12" /> return ; End of autoexecute section.</p>
<p class="calibre8">; Assign a hotkey to activate this group, which traverses<br class="calibre12" /> ; through all open MSIE windows, one at a time (i.e. each<br class="calibre12" /> ; press of the hotkey).<br class="calibre12" /> Numpad1::GroupActivate, MSIE, r<br class="calibre12" />
</p>
<p class="calibre8">; Here's a more complex group for MS Outlook 2002.<br class="calibre12" /> ; In the autoexecute section at the top of the script: <br class="calibre12" /> SetTitleMatchMode, 2 <br class="calibre12" /> GroupAdd, mail, Message - Microsoft Word ; This is for mails currently being composed <br class="calibre12" /> GroupAdd, mail, - Message ( ; This is for already opened items <br class="calibre12" /> ; Need extra text to avoid activation of a phantom window:<br class="calibre12" /> GroupAdd, mail, Advanced Find, Sear&amp;ch for the word(s)<br class="calibre12" /> GroupAdd, mail, , Recurrence: <br class="calibre12" /> GroupAdd, mail, Reminder <br class="calibre12" /> GroupAdd, mail, - Microsoft Outlook <br class="calibre12" /> return ; End of autoexecute section.</p>
<p class="calibre8">Numpad5::GroupActivate, mail ; Assign a hotkey to traverse through the group.</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="GroupClose.htm" href="#GroupClose.htm">#</a> <h2 class="calibre17">GroupClose</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Closes the active window if it was just activated by <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> or <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>. It then activates the next window in the series. It can also close all windows in a group. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GroupClose, GroupName [, A|R] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">GroupName</td>
<td width="85%" class="calibre4">The name of the group as originally defined by <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">A|R</td>
<td class="calibre4">
<p class="calibre8">If it's the letter A, all members of the group will be closed.</p>
<p class="calibre8">Otherwise: If the command closes the active window, it will then activate the next window in the series. This parameter determines whether the oldest or the newest window is activated. If omitted, the oldest window is always activated. If it's the letter R, the newest window (the one most recently active) is activated, but only if no members of the group are active when the command is given. "R" is useful in cases where you temporarily switch to working on an unrelated task. When you return to the group via <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>, or <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a>, the window you were most recently working with is activated rather than the oldest window.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">When the <em class="calibre21">A|R</em> parameter is not "A", the behavior of this command is determined by whether the previous action on <em class="calibre21">GroupName</em> was <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> or <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>. If it was <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>, this command will close the active window only if it is <strong class="calibre14">not</strong> a member of the group (otherwise it will do nothing). If it was <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> or nothing, this command will close the active window only if it <strong class="calibre14">is</strong> a member of the group (otherwise it will do nothing). This behavior allows GroupClose to be assigned to a hotkey as a companion to <em class="calibre21">GroupName</em>'s <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> or <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a> hotkey. </p>
<p class="calibre8">See <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a> for more details about window groups.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">GroupClose, MyGroup, R</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="GroupDeactivate.htm" href="#GroupDeactivate.htm">#</a> <h2 class="calibre17">GroupDeactivate</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Similar to <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> except activates the next window <strong class="calibre14">not</strong> in the group.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">GroupDeactivate, GroupName [, R] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">GroupName</td>
<td width="85%" class="calibre4">The name of the target group, as originally defined by <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">R</td>
<td class="calibre4">This determines whether the oldest or the newest non-member window is activated whenever a member of the group is currently active. If omitted, the oldest non-member window is always activated. If it's the letter R, the newest non-member window (the one most recently active) is activated, but only if a member of the group is active when the command is given. "R" is useful in cases where you temporarily switch to working on an unrelated task. When you return to the group via <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#GroupDeactivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupDeactivate</a>, or <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a>, the window you were most recently working with is activated rather than the oldest window.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">GroupDeactivate causes the first window that does <strong class="calibre14">not</strong> match any of the group's window specifications to be activated. Using GroupDeactivate a second time will activate the next window in the series and so on. Normally, GroupDeactivate is assigned to a hotkey so that this window-traversal behavior is automated by pressing that key.</p>
<p class="calibre8">This command is useful in cases where you have a collection of favorite windows that are almost always running. By adding these windows to a group, you can use GroupDeactivate to visit each window that isn't one of your favorites and decide whether to close it. This allows you to clean up your desktop much more quickly than doing it manually.</p>
<p class="calibre8" />
<p class="calibre8">See <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a> for more details about window groups.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#GroupClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupClose</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">GroupDeactivate, MyFavoriteWindows ; Visit non-favorite windows to clean up desktop.</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_WinActivateForce.htm" href="#h_WinActivateForce.htm">#</a> <h2 class="calibre17">#WinActivateForce</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Skips the gentle method of of activating a window and goes straight to the forceful method. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#WinActivateForce</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> Specifying this anywhere in a script will cause commands that activate a window -- such as <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#WinActivateBottom.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivateBottom</a>, and <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> -- to skip the "gentle" method of activating a window and go straight to the more forceful methods.</p>
<p class="calibre8">Although this directive will usually not change how quickly or reliably a window is activated, it might prevent task bar buttons from flashing when different windows are activated quickly one after the other.</p>
<p class="calibre8">Windows 95 and NT will probably never need this setting since they are more permissive about allowing windows to be activated.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#WinActivateBottom.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivateBottom</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#WinActivateForce</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="DetectHiddenText.htm" href="#DetectHiddenText.htm">#</a> <h2 class="calibre17">DetectHiddenText</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Determines whether invisible text in a window is "seen" for the purpose of finding the window. This affects commands such as IfWinExist and WinActivate.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">DetectHiddenText, On|Off </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">On|Off</td>
<td width="85%" class="calibre4">
<p class="calibre8">On: This is the default. Hidden text will be detected.</p>
<p class="calibre8">Off</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">"Hidden text" is a term that refers to those controls of a window that are not visible. Their text is thus considered "hidden". Turning off DetectHiddenText can be useful in cases where you want to detect the difference between the different panes of a multi-pane window or multi-tabbed dialog. Use Window Spy to determine which text of the currently-active window is hidden. All commands that accept a <em class="calibre21">WinText</em> parameter are affected by this setting, including <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, and <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_DetectHiddenText</strong> contains the current setting (On or Off).</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">DetectHiddenText, off</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="DetectHiddenWindows.htm" href="#DetectHiddenWindows.htm">#</a> <h2 class="calibre17">DetectHiddenWindows</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Determines whether invisible windows are "seen" by the script.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">DetectHiddenWindows, On|Off </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">On|Off</td>
<td width="85%" class="calibre4">
<p class="calibre8">On: Hidden windows are detected. </p>
<p class="calibre8">Off: This is the default. Hidden windows are not detected, except by the <a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a> command. </p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Turning on DetectHiddenWindows can make scripting harder in some cases since some hidden system windows might accidentally match the title or text of another window you're trying to work with. So most scripts should leave this setting turn off. However, turning it on may be useful if you wish to work with hidden windows directly without first using <a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a> to unhide them.</p>
<p class="calibre8">All windowing commands except <a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a> are affected by this setting, including <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>. In other words, <a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a> will always unhide a hidden window even if hidden windows are not being detected.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_DetectHiddenWindows</strong> contains the current setting (On or Off).</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">DetectHiddenWindows, on</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfWinActive.htm" href="#IfWinActive.htm">#</a> <h2 class="calibre17">IfWinActive / IfWinNotActive</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks to see if a specified window exists and is currently active (foreground).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IfWinActive [, WinTitle, WinText, ExcludeTitle, ExcludeText]<br class="calibre12" /> IfWinNotActive [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If all parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used.</p>
<p class="calibre8">If either of these commands determines that the active window is a qualified match, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be updated to be the active window. In other words, if <em class="calibre21">IfWinActive</em> evaluates to true or <em class="calibre21">IfWinNotActive</em> evaluates to false, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be updated.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">IfWinActive, Untitled - Notepad
{
WinMaximize, A ; "A" indicates the active window.
Send, Some text.{Enter}
return
}
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="IfWinExist.htm" href="#IfWinExist.htm">#</a> <h2 class="calibre17">IfWinExist / IfWinNotExist</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Checks to see if a specified window exists.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">IfWinExist [, WinTitle, WinText, ExcludeTitle, ExcludeText]<br class="calibre12" /> IfWinNotExist [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 parameters are all omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used (i.e. that specific window is checked to see whether it still exists). To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If all parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be checked to see if it still exists (or doesn't exist in the case of IfWinNotExist).</p>
<p class="calibre8">If either of these commands determines that a qualified window exists, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be updated to be that window. In other words, if <em class="calibre21">IfWinExist</em> evaluates to true or <em class="calibre21">IfWinNotExist</em> evaluates to false, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be updated.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a>, <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">IfWinExist, Untitled - Notepad
{
WinActivate ; Automatically uses the window found above.
WinMaximize ; same
Send, Some text.{Enter}
return
}
IfWinNotExist, Calculator
return
else
{
WinActivate ; The above "IfWinNotExist" also set the "last found" window for us.
WinMove, 40, 40 ; Move it to a new position.
return
}
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetTitleMatchMode.htm" href="#SetTitleMatchMode.htm">#</a> <h2 class="calibre17">SetTitleMatchMode</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Determines how window titles are searched for by various commands. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetTitleMatchMode, MatchMode<br class="calibre12" /> SetTitleMatchMode, Fast|Slow</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">
<p class="calibre8">MatchMode</p>
</td>
<td width="85%" class="calibre4">
<p class="calibre8">One of the following numbers:</p>
<p class="calibre8"><strong class="calibre14">1</strong>: A window's title must start with the specified <em class="calibre21">WinTitle</em> to be a match.<br class="calibre12" />
<strong class="calibre14">2</strong>: A window's title can contain <em class="calibre21">WinTitle </em>anywhere inside it to be a match. <br class="calibre12" />
<strong class="calibre14">3</strong> [v1.0.11]: A window's title must exactly match <em class="calibre21">WinTitle</em> to be a match.
</p>
<p class="calibre8">The above mode also affects <em class="calibre21">ExcludeTitle </em>in the same way. For example, mode 3 requires that a window's title exactly match <em class="calibre21">ExcludeTitle</em> for that window to be excluded.</p>
<p class="calibre8">Note that <em class="calibre21">WinTitle</em>, <em class="calibre21">WinText</em>, <em class="calibre21">ExcludeTitle</em> and <em class="calibre21">ExcludeText </em>are always case sensitive.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Fast|Slow</td>
<td class="calibre4">
<p class="calibre8"><strong class="calibre14">Fast</strong>: This is the normal behavior. Performance may be substantially better than <em class="calibre21">Slow</em>, but certain <em class="calibre21">WinText</em> elements for some types of windows may not be "seen" by the various window commands.</p>
<p class="calibre8"><strong class="calibre14">Slow</strong>: Can be much slower, but all possible <em class="calibre21">WinText</em> is retrieved from every window as a windowing command searches through them for a match.</p>
</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command affects the behavior of all windowing commands, e.g. <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a> and <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>.</p>
<p class="calibre8">If unspecified, TitleMatchMode defaults to 1 and <em class="calibre21">fast</em>.</p>
<p class="calibre8">Generally, the <em class="calibre21">slow</em> mode should only be used if the target window cannot be uniquely identified by its title and <em class="calibre21">fast</em>-mode text. This is because the slow mode can be extremely slow if there are any application windows that are busy or "not responding". In addition, such sluggish or unresponsive windows might cause keyboard and mouse lag if the <a href="#h_InstallKeybdHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard</a> or <a href="#h_InstallMouseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mouse</a> hook is installed while the <em class="calibre21">slow</em> mode is in effect. </p>
<p class="calibre8">The customized version of Window Spy distributed with AutoHotkey reports <em class="calibre21">slow</em> text in a separate section so that its easy to determine whether the <em class="calibre21">slow</em> mode is needed.</p>
<p class="calibre8">If you wish to change both attributes, run the command twice as in this example:<br class="calibre12" /> SetTitleMatchMode, 2<br class="calibre12" /> SetTitleMatchMode, slow</p>
<p class="calibre8">The built-in variables <strong class="calibre14">A_TitleMatchMode</strong> and <strong class="calibre14">A_TitleMatchModeSpeed</strong> contain the current settings.</p>
<p class="calibre8">Title and text matching are always case sensitive regardless of this setting.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>,<a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> WinActivate</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetTitleMatchMode, 2<br class="calibre12" /> SetTitleMatchMode, slow</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="SetWinDelay.htm" href="#SetWinDelay.htm">#</a> <h2 class="calibre17">SetWinDelay</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the delay that will occur after each windowing command. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">SetWinDelay, Delay </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Delay</td>
<td width="85%" class="calibre4">Time in milliseconds. Use -1 for no delay at all and 0 for the smallest possible delay. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A short delay (sleep) is automatically and invisibly done after every windowing command (e.g. WinActivate, IfWinExist, WinWait, etc.). This is done to improve the reliability of scripts because a window sometimes needs a period of "rest" after being created, activated, minimized, etc. so that it has a chance to update itself and respond to the next command that the script may attempt to send to it.</p>
<p class="calibre8">Although a delay of -1 (no delay at all) is allowed, it is recommended that at least 0 be used, to increase confidence that the script will run correctly even when the CPU is under load.</p>
<p class="calibre8">A delay of 0 internally executes a Sleep(0), which yields the remainder of the script's timeslice to any other process that may need it. If there is none, Sleep(0) will not sleep at all.</p>
<p class="calibre8">If the CPU is slow or under load, or if window animation is enabled, higher delay values may be needed. </p>
<p class="calibre8">If unset, the default delay is 250.</p>
<p class="calibre8">The built-in variable <strong class="calibre14">A_WinDelay</strong> contains the current setting.</p>
<p class="calibre8">Every newly launched <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed</a> subroutine starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part) of the script.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>,<a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> SetMouseDelay</a>,<a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> SetBatchLines</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">SetWinDelay, 10</p>
<p class="calibre8">  </p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="StatusBarGetText.htm" href="#StatusBarGetText.htm">#</a> <h2 class="calibre17">StatusBarGetText</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the text from a standard status bar control. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StatusBarGetText, OutputVar [, Part#, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">OutputVar</td>
<td class="calibre4">The name of the variable in which to store the retrieved text. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Part#</td>
<td class="calibre4">Which part number of the bar to retrieve. Default 1, which is usually the part that contains the text of interest.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the other 3 window parameters are blank or omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This functions attempts to read the first <em class="calibre21">standard</em> status bar on a window (Microsoft common control: msctls_statusbar32).  Some programs use their own status bars or special versions of the MS common control - the function cannot read these.</p>
<p class="calibre8">Rather than using this command in a loop, it is usually more efficient to use <a href="#StatusBarWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StatusBarWait, </a>which contains optimizations that avoid the overhead of repeated calls to StatusBarGetText.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#StatusBarWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StatusBarWait</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> StatusBarGetText, RetrievedText, 1, Search Results<br class="calibre12" /> IfInString, RetrievedText, found, MsgBox, Search results have been found. <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="StatusBarWait.htm" href="#StatusBarWait.htm">#</a> <h2 class="calibre17">StatusBarWait</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits until a window's status bar contains the specified string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">StatusBarWait [, BarText, Seconds, Part#, WinTitle, WinText, Interval, ExcludeTitle, ExcludeText] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">BarText</td>
<td class="calibre4">The text or partial text for the which the command will wait to appear. Default is blank (empty), which means to wait for the status bar to become blank. The text is case sensitive and the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, similar to <em class="calibre21">WinTitle</em> below. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">Seconds</td>
<td class="calibre4">The number of seconds (can contain a decimal point) to wait before timing out, in which case <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> will be set to 1. Default is blank, which means wait indefinitely. Specifying 0 is the same as specifying 0.5.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Part#</td>
<td class="calibre4">Which part number of the bar to retrieve. Default 1, which is usually the part that contains the text of interest.</td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the other 3 window parameters are blank or omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">Interval</td>
<td class="calibre4">How often the status bar should be checked while the command is waiting (in milliseconds). Default is 50. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the command times out before a match could be found in the status bar. It is set to 2 if the status bar could not be accessed. It is set to 0 if a match is found.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This functions attempts to read the first <em class="calibre21">standard</em> status bar on a window (Microsoft common control: msctls_statusbar32).  Some programs use their own status bars or special versions of the MS common control - the function cannot read these.</p>
<p class="calibre8">Rather than using <a href="#StatusBarGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StatusBarGetText</a> in a loop, it is usually more efficient to use this command<a href="#StatusBarWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">, </a>which contains optimizations that avoid the overhead that repeated calls to <a href="#StatusBarGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StatusBarGetText</a> would incur.</p>
<p class="calibre8">While the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#StatusBarGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StatusBarGetText</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">IfWinExist, Search Results ; Sets the Last Found window to simplify the below.
{
WinActivate
Send, {tab 2}!o*.txt{enter}
Sleep, 400 ; Give the status bar time to change to "Searching".
<strong class="calibre14">StatusBarWait, found, 30</strong>
if ErrorLevel = 0
MsgBox, The search successfully completed.
else
MsgBox, The command timed out or there was a problem.
}</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinActivate.htm" href="#WinActivate.htm">#</a> <h2 class="calibre17">WinActivate</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Activates (brings to the foreground) a window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinActivate [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If all parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be activated. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 tbd">Six attempts will be made to activate the target window over the course of 60ms. Thus, it is usually unnecessary to follow it with the <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a> command.</p>
<p class="calibre8">If a matching window is already active, that window will be kept active rather than activating any other matching window beneath it. In general, if more than one window matches, the uppermost (most recently used) will be activated. You can activate the bottommost (least recently used) via <a href="#WinActivateBottom.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivateBottom</a>. </p>
<p class="calibre8">When a window is activated immediately after another window was activated, task bar buttons might start flashing on some systems (depending on OS and settings). To prevent this, use <a href="#h_WinActivateForce.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#WinActivateForce</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinActivateBottom.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivateBottom</a>, <a href="#h_WinActivateForce.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#WinActivateForce</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a>, <a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a>, <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">IfWinExist, Untitled - Notepad
WinActivate ; use the window found above
else
WinActivate, Calculator</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinActivateBottom.htm" href="#WinActivateBottom.htm">#</a> <h2 class="calibre17">WinActivateBottom</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Same as <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a> except it activates the least recently used (bottommost) matching window rather than the newest.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinActivateBottom [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If there is only one matching window, WinActivateBottom behaves identically to <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>.</p>
<p class="calibre8"><a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Window groups</a> are more advanced than this command, so consider using them for more features and flexibility.</p>
<p class="calibre8">Six attempts will be made to activate the target window over the course of 60ms. Thus, it is usually unnecessary to follow it with the <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a> command.</p>
<p class="calibre8">Unlike <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> cannot be used because it might not be the bottommost window. Therefore, at least one of the parameters must be non-blank. </p>
<p class="calibre8">When a window is activated immediately after another window was activated, task bar buttons may start flashing on some systems (depending on OS and settings). To prevent this, use <a href="#h_WinActivateForce.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#WinActivateForce</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> WinActivate</a>, <a href="#h_WinActivateForce.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#WinActivateForce</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">; This hotkey allows you to visit all open browser windows in order<br class="calibre12" /> ; from oldest to newest:<br class="calibre12" /> #i::<br class="calibre12" /> SetTitleMatchMode, 2<br class="calibre12" /> WinActivateBottom, - Microsoft Internet Explorer<br class="calibre12" /> return</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinClose.htm" href="#WinClose.htm">#</a> <h2 class="calibre17">WinClose</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Closes a window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinClose [, WinTitle, WinText, <span class="tbd">SecondsToWait</span>, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the other 3 window parameters are blank or omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4"><span class="">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">SecondsToWait</td>
<td class="calibre4 tbd">If omitted or blank, the command will not wait at all. If 0, it will wait 500ms. Otherwise, it will wait the indicated number of seconds (can contain a decimal point) for the window to close. If the window does not close within that period, the script will continue. ErrorLevel is <strong class="calibre14">not</strong> set by this command, so use <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a> or <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a> if you need to determine for certain that a window is closed. While the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command sends a close message to a window. The result depends on the window (it may ask to save data, etc.)</p>
<p class="calibre8">If a matching window is active, that window will be closed in preference to any other matching window beneath it. In general, if more than one window matches, the uppermost (most recently used) will be closed.</p>
<p class="calibre8">If a window does not close via WinClose, you can force it to close with <a href="#WinKill.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinKill</a>. </p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinKill.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinKill</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a>, <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a>, <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">IfWinExist, Untitled - Notepad
WinClose ; use the window found above
else
WinClose, Calculator</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinGet.htm" href="#WinGet.htm">#</a> <h2 class="calibre17">WinGet</h2> [v1.0.12+]
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves a window's unique ID, process ID/name, or a list of its controls. It can also find all windows of a certain class, title, or text.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinGet, OutputVar [, Cmd, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the result of <em class="calibre21">Cmd</em>.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Cmd</td>
<td class="calibre4">See list below. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy).</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><em class="calibre21">Cmd</em> is the operation to perform, which if blank defaults to <em class="calibre21">ID</em>. It can be one of the following words:</p>
<p class="calibre8"><strong class="calibre14">ID</strong>: Retrieves the unique ID number for the first window matching the specified <em class="calibre21">WinTitle</em>, <em class="calibre21">WinText</em>, <em class="calibre21">ExcludeTitle</em>, and <em class="calibre21">ExcludeText</em>. If there is none, <em class="calibre21">OutputVar</em> is made blank.</p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">IDLast</strong>: Same as above except it retrieves the ID of the last/bottommost window if there is more than one match. If there is only one match, it performs identically to <em class="calibre21">ID</em>. This concept is similar to that used by <a href="#WinActivateBottom.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivateBottom</a>.</p>
<p class="calibre8"><strong class="calibre14">PID</strong> [v1.0.18+]: Retrieves the <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process ID (PID)</a> for the first window matching the specified <em class="calibre21">WinTitle</em>, <em class="calibre21">WinText</em>, <em class="calibre21">ExcludeTitle</em>, and <em class="calibre21">ExcludeText</em>.</p>
<p class="calibre8"><strong class="calibre14">ProcessName</strong> [v1.0.22+]: Retrieves the name of the process (e.g. notepad.exe) that owns the first matching window. If there are no matching windows, <em class="calibre21">OutputVar</em> is made blank.</p>
<p class="calibre8"><strong class="calibre14">Count</strong>: Retrieves the number of matching windows that exist (0 if none).</p>
<p class="calibre8"><strong class="calibre14">List</strong>: Retrieves the unique ID numbers for all matching windows (to retrieve all windows on the entire system, leave <em class="calibre21">WinTitle</em> and <em class="calibre21">WinText</em> blank but specify Program Manager or a non-existent title for <em class="calibre21">ExcludeTitle</em>). Each ID number is stored in an <a href="#Arrays.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">array element</a> whose name begins with <em class="calibre21">OutputVar</em>'s own name, while <em class="calibre21">OutputVar</em> itself is set to the number of retrieved items (0 if none). For example, if <em class="calibre21">OutputVar</em> is MyArray and two matching windows are discovered, MyArray1 will be set to the ID of the first window, MyArray2 will be set to the ID of the second window, and MyArray itself will be set to the number 2.</p>
<p class="calibre8"><strong class="calibre14">MinMax</strong> [v1.0.22+]: Retrieves the minimized/maximized state for the first matching window. <em class="calibre21">OuputVar</em> is made blank if no matching window exists; otherwise, it is set to one of the following numbers:<br class="calibre12" /> -1: The window is minimized (<a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a> can unminimize it). <br class="calibre12" /> 1: The window is maximized (<a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a> can unmaximize it).<br class="calibre12" /> 0: The window is neither minimized nor maximized.</p>
</div>
<p class="calibre8"><strong class="calibre14">ControlList</strong> Retrieves the control names for all <span class="x11">interactive</span> controls in the first window matching the specified <em class="calibre21">WinTitle</em>, <em class="calibre21">WinText</em>, <em class="calibre21">ExcludeTitle</em>, and <em class="calibre21">ExcludeText</em>. If there are no controls or the target window does not exist, <em class="calibre21">OutputVar</em> is made blank. Otherwise, each control name consists of its class name followed immediately by its sequence number, as shown by Window Spy.</p>
<p class="calibre8">Each item except the last is terminated by a linefeed (`n). To examine the individual control names one by one, use a <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> as shown in the examples section below.</p>
<p class="calibre8">Controls are sorted according to their Z-order, which is usually the same order as TAB key navigation if the window supports tabbing.</p>
<p class="calibre8">The control currently under the mouse cursor can be retrieved with <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>. </p>
<div class="tbd">
<p class="calibre8"><strong class="calibre14">Style</strong> or <strong class="calibre14">ExStyle</strong> [v1.0.23+]: Retrieves an 8-digit hexadecimal number representing style or extended style (respectively) of the first matching window. If there are no matching windows, <em class="calibre21">OutputVar</em> is made blank. The following example determines whether a window has the WS_DISABLED style:</p>
<p class="calibre8">WinGet, Style, My Window Title<br class="calibre12" /> Transform, Result, BitAnd, %Style%, 0x8000000 ; 0x8000000 is WS_DISABLED.<br class="calibre12" /> if Result &lt;&gt; 0<br class="calibre12" /> ... the window is disabled, so perform appropriate action.</p>
<p class="calibre8">The next example determines whether a window has the WS_EX_TOPMOST style (always-on-top):</p>
<p class="calibre8">WinGet, ExStyle, My Window Title<br class="calibre12" /> Transform, Result, BitAnd, %ExStyle%, 0x8 ; 0x8 is WS_EX_TOPMOST.<br class="calibre12" /> if Result &lt;&gt; 0<br class="calibre12" /> ... the window is always-on-top, so perform appropriate action.</p>
<p class="calibre8">See <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> for more details about styles and extended styles.</p>
<p class="calibre8"> </p>
</div>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">A window's ID number is valid only during its lifetime. In other words, if an application restarts, all of its windows will get new ID numbers.</p>
<p class="calibre8">ID numbers retrieved by this command are numeric (the prefix "ahk_id" is not included) and are stored in hexadecimal format regardless of the setting of <a href="#SetFormat.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetFormat</a>.</p>
<p class="calibre8">The ID of the window under the mouse cursor can be retrieved with <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>. </p>
<p class="calibre8">Although ID numbers are currently 32-bit unsigned values, they may become 64-bit in future versions. Therefore, it is unsafe to perform numerical operations such as addition on these values because such operations require that their input strings be parsable as signed rather than unsigned values.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGetClass.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetClass</a>, <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>, <a href="#Control.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Control</a>, <a href="#ControlFocus.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlFocus</a>, <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupAdd</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Examples</strong></p>
<pre class="calibre22">; Example #1: Maximize the active window and report its unique ID:
WinGet, active_id, ID, A
WinMaximize, ahk_id %active_id%
MsgBox, The active window's ID is "%active_id%".
; Example #2: This will visit all windows on the entire system and display info about each of them:
WinGet, id, list,,, Program Manager
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0
WinActivate, ahk_id %this_id%
WinGetClass, this_class, ahk_id %this_id%
WinGetTitle, this_title, ahk_id %this_id%
MsgBox, 4, , Visiting All Windows`n%a_index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n`nContinue?
IfMsgBox, NO, break
}
Example #3: Extract the individual control names from a ControlList:
WinGet, ActiveControlList, ControlList, A
Loop, Parse, ActiveControlList, `n
{
MsgBox, 4,, Control #%a_index% is "%A_LoopField%". Continue?
IfMsgBox, No
break
}
Example #4: Display in real time the active window's control list:
#Persistent
SetTimer, WatchActiveWindow, 200
return
WatchActiveWindow:
WinGet, ControlList, ControlList, A
ToolTip, %ControlList%
return</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinGetActiveStats.htm" href="#WinGetActiveStats.htm">#</a> <h2 class="calibre17">WinGetActiveStats</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Combines the functions of <a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a> and <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a> into one command.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinGetActiveStats, Title, Width, Height, X, Y </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Title</td>
<td width="85%" class="calibre4">The name of the variable in which to store the title of the active window.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">Width/Height</td>
<td class="calibre4">The names of the variables in which to store the width and height of the active window.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">X, Y </td>
<td class="calibre4">The names of the variables in which to store the X and Y coordinates of the active window's upper left corner. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If no matching window is found, the output variables will be made blank.</p>
<p class="calibre8">This command is equivalent to the following sequence:<br class="calibre12" />
<a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, Title, A<br class="calibre12" />
<a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a>, X, Y, Width, Height, A
</p>
<p class="calibre8">If the active window is a hidden window and <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> is off (the default), all commands except <a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a> will fail to "see" it. If there is no active window for this reason or any other, this command will set all of its output variables to be blank.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a>, <a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, <a href="#WinGetClass.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetClass</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">WinGetActiveStats, Title, Width, Height, X, Y<br class="calibre12" /> MsgBox, The active window "%Title%" is %Width% wide`, %Height% tall`, and positioned at %X%`,%Y%.</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinGetActiveTitle.htm" href="#WinGetActiveTitle.htm">#</a> <h2 class="calibre17">WinGetActiveTitle</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the title of the active window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinGetActiveTitle, OutputVar </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the title of the active window. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This command is equivalent to: <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, OutputVar, A</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a>, <a href="#WinGetActiveStats.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveStats</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, <a href="#WinGetClass.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetClass</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">WinGetActiveTitle, Title<br class="calibre12" /> MsgBox, The active window is "%Title%".</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinGetClass.htm" href="#WinGetClass.htm">#</a> <h2 class="calibre17">WinGetClass</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves a window's class name.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinGetClass, OutputVar [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved class name.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Only the class name is retrieved (the prefix "ahk_class" is not included in <em class="calibre21">OutputVar</em>).</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">WinGetClass, class, A
MsgBox, The active window's class is "%class%".</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinGetPos.htm" href="#WinGetPos.htm">#</a> <h2 class="calibre17">WinGetPos</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the position and size of a given window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinGetPos [, X, Y, Width, Height, WinTitle, WinText, ExcludeTitle, ExcludeText] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4">X, Y</td>
<td class="calibre4">The names of the variables in which to store the X and Y coordinates of the target window's upper left corner. If omitted, the corresponding values will not be stored. </td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">Width/Height</td>
<td width="85%" class="calibre4">The names of the variables in which to store the width and height of the target window. If omitted, the corresponding values will not be stored.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If no matching window is found, the output variables will be made blank.</p>
<p class="calibre8 tbd">If the <em class="calibre21">WinTitle</em> Program Manager is used, the command will retrieve the size of the desktop, which is usually the same as the current screen resolution.</p>
<p class="calibre8">A minimized window will still have a position and size. The values returned in this case may vary depending on OS and configuration.</p>
<p class="calibre8">To discover the name of the window and control that the mouse is currently hovering over, use <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>, <a href="#ControlGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetPos</a>, <a href="#WinGetActiveStats.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveStats</a>, <a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">WinGetPos, X, Y, Width, Height, Calculator
MsgBox, Calculator is at %X%`,%Y%
WinGetPos, X, Y, , , A ; "A" to get the active window's pos.
MsgBox, The active window is at %X%`,%Y%
IfWinExist, Untitled - Notepad
{
WinGetPos, Xpos, Ypos ; Uses the window found above.
MsgBox, Notepad is at %Xpos%`,%Ypos%
}
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinGetText.htm" href="#WinGetText.htm">#</a> <h2 class="calibre17">WinGetText</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the text from a window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinGetText, OutputVar [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved text.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="x11">This command relies on accessibility support. <a href="#Accessibility.htm">Please read this section</a> to avoid problems.</p>
<p class="calibre8">The text retrieved is generally the same as what Window Spy shows for that window.</p>
<p class="calibre8">Each text element ends with a <span class="rm">carriage return and</span> linefeed (<span class="rm">CR+</span>LF), which can be represented in the script as <span class="rm">`r</span>`n</p>
<p class="calibre8 tbd">The amount of text retrieved is limited to a variable's maximum capacity (which can be changed via the <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a> directive). As a result, this command might use a large amount of RAM if the target window (e.g. an editor with a large document open) contains a large quantity of text. To avoid this, it might be possible to retrieve only portions of the window's text by using <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a> instead. However, a variable's memory can be freed after use by assigning it to nothing, i.e. OutputVar =</p>
<p class="calibre8 rm">Windows 95/98/ME may be limited to 64K for some text elements of certain windows.</p>
<p class="calibre8">To retrieve a list of all controls in a window, use <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8 x11">at-spi children are only iterated over 1,000 children per node max (both in/visible) to prevent too long execution time. This means that for windows with lists of many elements, this command may not return all of them, even if the ones visible are but few.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGetActiveStats.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveStats</a>, <a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a>, <a href="#WinGetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetTitle</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a>, <a href="#h_MaxMem.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxMem</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Run, calc
WinWait, Calculator
WinGetText, text ; The window found above will be used.
MsgBox, The text is:`n%text%</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinGetTitle.htm" href="#WinGetTitle.htm">#</a> <h2 class="calibre17">WinGetTitle</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Retrieves the full title from a window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinGetTitle, OutputVar [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">OutputVar</td>
<td width="85%" class="calibre4">The name of the variable in which to store the retrieved title.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">To discover the name of the window that the mouse is currently hovering over, use <a href="#MouseGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MouseGetPos</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGetActiveStats.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveStats</a>, <a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a>, <a href="#WinGetClass.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetClass</a>, <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">WinGetTitle, Title, A
MsgBox, The active window is "%Title%".</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinHide.htm" href="#WinHide.htm">#</a> <h2 class="calibre17">WinHide</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Hides a window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinHide [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the other 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Use <a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a> to unhide a hidden window (<a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> need not be ON to do this). </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinShow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinShow</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a>, <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Run, notepad.exe
WinWait, Untitled - Notepad
Sleep, 500
WinHide ; use the window found above
Sleep, 1000
WinShow
</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinKill.htm" href="#WinKill.htm">#</a> <h2 class="calibre17">WinKill</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Forces a window to close.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinKill [, WinTitle, WinText, SecondsToWait, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the other 3 window parameters are blank or omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3 tbd">
<td class="calibre4">SecondsToWait</td>
<td class="calibre4">If omitted or blank, the command will not wait at all. If 0, it will wait 500ms. Otherwise, it will wait the indicated number of seconds (can contain a decimal point) for the window to close. If the window does not close within that period, the script will continue. ErrorLevel is <strong class="calibre14">not</strong> set by this command, so use <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a> or <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a> if you need to determine for certain that a window is closed. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"><span class="tbd">This command first makes a brief attempt to close the window normally. If that fails,</span> it will attempt to force the window closed by terminating its process.</p>
<p class="calibre8">If a matching window is active, that window will be closed in preference to any other matching window beneath it. In general, if more than one window matches, the uppermost (most recently used) will be closed.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a>, <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a>, <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#GroupActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GroupActivate</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">IfWinExist, Untitled - Notepad
WinKill ; use the window found above
else
WinKill, Calculator</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinMaximize.htm" href="#WinMaximize.htm">#</a> <h2 class="calibre17">WinMaximize</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Enlarges a window to its maximum size. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinMaximize [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Use <a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a> to unmaximize a window and <a href="#WinMinimize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimize</a> to minimize it. </p>
<p class="calibre8">If a particular type of window does not respond correctly to WinMaximize, try using the following instead:<br class="calibre12" />
<a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PostMessage, </a>0x112, 0xF030,,, WinTitle, WinText ; 0x112 = WM_SYSCOMMAND, 0xF030 = SC_MAXIMIZE
</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a>, <a href="#WinMinimize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimize</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Run, notepad.exe
WinWait, Untitled - Notepad
WinMaximize ; use the window found above
^Up::WinMaximize, A ; Assign a hotkey to maximize the active window.</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinMinimize.htm" href="#WinMinimize.htm">#</a> <h2 class="calibre17">WinMinimize</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Collapses a window into a button on the task bar. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinMinimize [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Use <a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a> or <a href="#WinMaximize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMaximize</a> to unminimize a window.</p>
<p class="calibre8 rm">If a particular type of window does not respond correctly to WinMinimize, try using the following instead:<br class="calibre12" />
<a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PostMessage, </a>0x112, 0xF020,,, WinTitle, WinText ; 0x112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE
</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinRestore.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinRestore</a>, <a href="#WinMaximize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMaximize</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Run, notepad.exe
WinWait, Untitled - Notepad
WinMinimize ; use the window found above
^Down::WinMinimize, A ; Assign a hotkey to minimize the active window.</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinMinimizeAll.htm" href="#WinMinimizeAll.htm">#</a> <h2 class="calibre17">WinMinimizeAll / WinMinimizeAllUndo</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Minimizes all windows or undoes a previous WinMinimizeAll.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinMinimizeAll<br class="calibre12" /> WinMinimizeAllUndo</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">On most systems, this is equivalent to the Explorer's Win-M and Win-D hotkeys.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8"> WinMinimizeAll<br class="calibre12" /> WinMinimizeAllUndo<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinMove.htm" href="#WinMove.htm">#</a> <h2 class="calibre17">WinMove</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the position and (optionally) the size of a window. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinMove, X, Y <br class="calibre12" /> WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">X, Y</td>
<td width="85%" class="calibre4">The X and Y coordinates of the upper left corner of the target window's new location. If these are the only parameters given with the command, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used as the target window. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the other 3 window parameters are blank or omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">Width, Height</td>
<td class="calibre4">The new size of the window. If either is omitted, blank, or the word DEFAULT, the size in that dimension will not be changed.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 tbd"> If <em class="calibre21">Width</em> and <em class="calibre21">Height</em> are small (or negative), the window will go no smaller than 112 x 27 pixels. If <em class="calibre21">Width</em> and <em class="calibre21">Height</em> are large, the window will go no larger than approximately 12 pixels beyond the dimensions of the desktop.</p>
<p class="calibre8">Negative values are allowed for the x and y coordinates to support multi-monitor systems and to allow a window to be moved entirely off screen.</p>
<p class="calibre8">Although WinMove cannot move minimized windows, it can move hidden windows if <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> is on.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#ControlMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlMove</a>, <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a>, <a href="#WinHide.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinHide</a>, <a href="#WinMinimize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimize</a>, <a href="#WinMaximize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMaximize</a>, <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">Run, calc.exe<br class="calibre12" /> WinWait, Calculator<br class="calibre12" /> WinMove, 0, 0 ; Move the window found by WinWait.</p>
<p class="calibre8">SplashTextOn, 400, 300, Clipboard, The clipboard contains:`n%clipboard%<br class="calibre12" /> WinMove, Clipboard, , 0, 0 ; Move the splash window to the top left corner. <br class="calibre12" /> Msgbox, Press OK to dismiss the SplashText<br class="calibre12" /> SplashTextOff<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinRestore.htm" href="#WinRestore.htm">#</a> <h2 class="calibre17">WinRestore</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Unminimizes or unmaximizes a window if it is <span class="tbd">minimized or</span> maximized.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinRestore [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 rm">If a particular type of window does not respond correctly to WinRestore, try using the following instead:<br class="calibre12" />
<a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PostMessage, </a>0x112, 0xF120,,, WinTitle, WinText ; 0x112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinMinimize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMinimize</a>, <a href="#WinMaximize.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMaximize</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p> WinRestore, Untitled - Notepad
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WinSet.htm" href="#WinSet.htm">#</a> <h2 class="calibre17">WinSet</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Makes a window "always on top" and/or transparent. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4"> WinSet, Attribute, Value [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Attribute, Value </td>
<td width="85%" class="calibre4">See list below. </td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14"><u class="calibre20">Attribute, Value</u></strong></p>
<p class="calibre8"><strong class="calibre14">AlwaysOnTop</strong>, <strong class="calibre14">[On|Off|Toggle]</strong>: Makes a window stay on top of all other windows. Use ON to turn on the setting, OFF to turn it off, or TOGGLE to set it to the opposite of its current state. If omitted, it defaults to TOGGLE. The word Topmost can be used in place of AlwaysOnTop.</p>
<p class="calibre8"><strong class="calibre14">Bottom</strong> Sends a window to the bottom of stack; that is, beneath all other windows. The effect is similar to pressing Alt-Escape. Example: WinSet, Bottom,, WinTitle </p>
<p class="calibre8"><strong class="calibre14">Transparent, N</strong>: Makes a window semi-transparent. Specify for <em class="calibre21">N</em> a number between 0 and 255 to indicate the degree of transparency: 0 makes the window invisible while 255 makes it opaque. In v1.0.23+, transparency may be turned off completely for a window by specifying the word OFF. This is different than specifying 255 because it may improve performance and reduce system resource usage.</p>
<p class="calibre8"><strong class="calibre14">TransColor, Color [N]</strong>: Makes all pixels of the chosen color invisible inside the target window, which allows the contents of the window behind it to show through. <span class="rm">If the user clicks on an invisible pixel, the click will "fall through" to the window behind it.</span> Specify for <em class="calibre21">Color</em> a color name or RGB value (see the <a href="#Progress.htm__colors" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">color chart</a> for guidance, or use <a href="#PixelGetColor.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelGetColor</a> in its RGB mode). <span class="tbd">To additionally make the visible part of the window partially transparent, append a space (not a comma) followed by the transparency level (0-255). Example: WinSet, TransColor, EEAA99 150, WinTitle</span> </p>
<p class="calibre8">TransColor is often used to create on-screen displays and other visual effects; see the bottom of the <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> page for an example. TransColor requires v1.0.23+.</p>
<p class="calibre8 x11">Only works in conjunction with Gui, Color. Not supported on non-Gui windows.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8 rm">To make the task bar transparent, use <em class="calibre21">WinSet, Transparent, 150, ahk_class Shell_TrayWnd</em>. Similarly, to make the Start Menu transparent, follow this example:<br class="calibre12" /> DetectHiddenWindows, on<br class="calibre12" /> WinSet, Transparent, 150, ahk_class BaseBar</p>
<p class="calibre8">To make all or selected menus on the entire system transparent, keep a script such as the following always running. Note that although such a script cannot make its own menus transparent, it can make those of other scripts transparent:</p>
<pre class="calibre22">#Persistent
SetTimer, WatchForMenu, 5
return ; End of auto-execute section.
WatchForMenu:
DetectHiddenWindows, on ; Might allow detection of menu sooner.
IfWinExist, ahk_class #32768
WinSet, Transparent, 150 ; Uses the window found by the above line.
return
</pre> A script's <a href="#SplashTextOn.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SplashText</a> window can be made non-AlwaysOnTop with this command. <p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>, <a href="#WinHide.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinHide</a>, <a href="#WinSetTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSetTitle</a>, <a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>, <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinActivate</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">WinSet, transparent, 200, Untitled - Notepad ; Make the window a little bit transparent.</p>
<p class="calibre8">WinSet, AlwaysOnTop, toggle, Calculator ; Toggle the always-on-top status of Calculator.</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinSetTitle.htm" href="#WinSetTitle.htm">#</a> <h2 class="calibre17">WinSetTitle</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the title of a window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinSetTitle, NewTitle<br class="calibre12" /> WinSetTitle, WinTitle, WinText, NewTitle [, ExcludeTitle, ExcludeText] </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">NewTitle</td>
<td width="85%" class="calibre4">The new title for the window. If this is the only parameter given, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinTitle</td>
<td class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the next 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. If this is the letter A and the next 3 parameters are omitted, the active window will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinMove.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinMove</a>, <a href="#WinGetActiveStats.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveStats</a>, <a href="#WinGetActiveTitle.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetActiveTitle</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#WinGetPos.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetPos</a>, <a href="#WinSet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinSet</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">WinSetTitle, Untitled - Notepad, , This is a new title</p>
<p class="calibre8">; Alternate:<br class="calibre12" /> Run, notepad.exe<br class="calibre12" /> WinWaitActive, Untitled - Notepad<br class="calibre12" /> WinSetTitle, This is a new title ; Uses the window found above by WinWaitActive<br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinShow.htm" href="#WinShow.htm">#</a> <h2 class="calibre17">WinShow</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Unhides a hidden window.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinShow [, WinTitle, WinText, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 parameters are omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">By default, WinShow is the only command that can detect hidden windows. You can change this via <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinHide.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinHide</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a>, <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Run, notepad.exe
WinWait, Untitled - Notepad
Sleep, 500
WinHide ; use the window found above
Sleep, 1000
WinShow
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinWait.htm" href="#WinWait.htm">#</a> <h2 class="calibre17">WinWait</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits until the requested window exists.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinWait, WinTitle, WinText, Seconds [, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). To use a window class, specify ahk_class ExactClassName (shown by Window Spy).</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">Seconds</td>
<td class="calibre4">How many seconds to wait before timing out and setting <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 1. Leave blank to wait indefinitely. Specifying 0 is the same as specifying 0.5.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the command timed out or 0 otherwise. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If a matching window comes into existence, the command will not wait for <em class="calibre21">Seconds</em> to expire. Instead, it will immediately set <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 0, update the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a>, and the script will continue executing.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8">While the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Run, notepad.exe
WinWait, Untitled - Notepad, , 2
if ErrorLevel &lt;&gt; 0
{
MsgBox, WinWait timed out.
return
}
else
WinMinimize ; minimize the window found by WinWait.
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinWaitActive.htm" href="#WinWaitActive.htm">#</a> <h2 class="calibre17">WinWaitActive / WinWaitNotActive</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits until the requested window is active or not active. </p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinWaitActive [, WinTitle, WinText, Seconds, ExcludeTitle, ExcludeText]<br class="calibre12" /> WinWaitNotActive [, WinTitle, WinText, Seconds, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">Seconds</td>
<td class="calibre4">How many seconds to wait before timing out and setting <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 1. Leave blank to wait indefinitely. Specifying 0 is the same as specifying 0.5.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the command timed out or 0 otherwise. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If a matching window satisfies the command's expectation, it will not wait for <em class="calibre21">Seconds</em> to expire. Instead, it will immediately set <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 0 and the script will continue executing.</p>
<p class="calibre8">Both of these commands will update the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> if a qualified window is active when the command begins.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8">While the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinWaitClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitClose</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">Run, notepad.exe
WinWaitActive, Untitled - Notepad, , 2
if ErrorLevel &lt;&gt; 0
{
MsgBox, WinWait timed out.
return
}
else
WinMinimize ; minimize the window found by WinWaitActive.
</pre>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="WinWaitClose.htm" href="#WinWaitClose.htm">#</a> <h2 class="calibre17">WinWaitClose</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Waits until the requested window does not exist.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">WinWaitClose, WinTitle, WinText, Seconds [, ExcludeTitle, ExcludeText]</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">WinTitle</td>
<td width="85%" class="calibre4">
<p class="calibre8">The title or partial title of the target window (the matching behavior is determined by <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>). If this and the other 3 window parameters are blank or omitted, the <a href="#LastFoundWindow.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Last Found Window</a> will be used. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a window's <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">unique ID number</a>, specify ahk_id IDNumber.</p>
</td>
</tr>
<tr class="calibre3">
<td class="calibre4">WinText</td>
<td class="calibre4">If present, this parameter must be a substring from a single text element of the target window. Hidden text elements are detected if <a href="#DetectHiddenText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenText</a> is ON. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
<tr class="calibre3">
<td class="calibre4">Seconds</td>
<td class="calibre4">How many seconds to wait before timing out and setting <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 1. Leave blank to wait indefinitely. Specifying 0 is the same as specifying 0.5.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeTitle</td>
<td class="calibre4">Windows whose titles include this value will not be considered.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">ExcludeText</td>
<td class="calibre4">Windows whose text include this value will not be considered. <span class="x11">This option relies on <a href="#Accessibility.htm">accessibility support</a>.</span></td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">ErrorLevel</strong></p>
<p class="calibre8"><a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> is set to 1 if the command timed out or 0 otherwise. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">Whenever no instances of the specified window exist, the command will not wait for <em class="calibre21">Seconds</em> to expire. Instead, it will immediately set <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> to 0 and the script will continue executing.</p>
<p class="calibre8">While the command is in a waiting state, new <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">threads</a> can be launched via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>, or <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timer</a>.</p>
<p class="calibre8">Window titles and text are always case sensitive. Hidden windows are not detected unless <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a> has been turned on.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#WinClose.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinClose</a>, <a href="#WinWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWait</a>, <a href="#WinWaitActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinWaitActive</a>, <a href="#IfWinExist.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinExist</a>, <a href="#IfWinActive.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IfWinActive</a>, <a href="#Process.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Process</a>, <a href="#SetTitleMatchMode.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTitleMatchMode</a>, <a href="#DetectHiddenWindows.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">DetectHiddenWindows</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p> Run, notepad.exe<br class="calibre12" /> WinWait, Untitled - Notepad<br class="calibre12" /> WinWaitClose ; Wait for the exact window found by WinWait to be closed.<br class="calibre12" /> MsgBox, Notepad is now closed.
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_CommentFlag.htm" href="#h_CommentFlag.htm">#</a> <h2 class="calibre17">#CommentFlag</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the script's comment symbol from semicolon to some other string.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#CommentFlag NewString</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td height="24" width="15%" class="calibre4">NewString</td>
<td width="85%" class="calibre4">One or more characters that should be used as the new comment flag. Up to 15 characters may be specified. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The default comment flag is semicolon (;). </p>
<p class="calibre8">The comment flag is used to indicate that text that follows it should not be acted upon by the script (comments aren't even loaded into memory when a script is launched).</p>
<p class="calibre8">A comment flag that appears on the same line as a command is not considered to mark a comment unless it has at least one space or tab to its left. For example:<br class="calibre12" /> MsgBox, Test1 ; This is a comment.<br class="calibre12" /> MsgBox, Test2; This is not a comment and will be displayed by MsgBox. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#EscapeChar</a></p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p> #CommentFlag // ; Change to C++ style of comments. <br class="calibre12" />
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_ErrorStdOut.htm" href="#h_ErrorStdOut.htm">#</a> <h2 class="calibre17">#ErrorStdOut</h2> [v1.0.14+]
<hr size="2" class="calibre24" />
<p class="calibre8">Sends any syntax error that prevents a script from launching to stdout rather than displaying a dialog.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#ErrorStdOut</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p> None <p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">This allows fancy editors such as Textpad, Scite, Crimson, and EditPlus to jump to the offending line when a syntax error occurs.</p>
<p class="calibre8">Since this directive would have to be added to every script, it's usually better to set up your editor to use the <a href="#Scripts.htm__cmd" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">command line parameter</a> <strong class="calibre14">/ErrorStdOut</strong> when launching an AutoHotkey script. The following example is for EditPlus:</p>
<p class="calibre8">Command: C:\Program Files\AutoHotkey\AutoHotkey.exe<br class="calibre12" /> Argument: /ErrorStdOut $(FilePath)<br class="calibre12" /> Initial directory: $(FileDir) <br class="calibre12" /> Capture output: Yes </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p> #ErrorStdOut<br class="calibre12" />
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_EscapeChar.htm" href="#h_EscapeChar.htm">#</a> <h2 class="calibre17">#EscapeChar (and discussion of escape sequences)</h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Changes the script's escape character (e.g. accent vs. backslash).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#EscapeChar NewChar</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">NewChar</td>
<td width="85%" class="calibre4">Specifies a single character.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">The escape character defaults to accent (`).</p>
<p class="calibre8">The escape character is used to indicate that the character immediately following it should be interpreted differently than it normally would.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Escape Sequences (when accent is the escape character)</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">Type This </strong></td>
<td class="calibre4"><strong class="calibre14">To Get This </strong></td>
</tr>
<tr class="calibre3">
<td width="15%" class="calibre4">`,</td>
<td width="85%" class="calibre4">, (literal comma) Note: Commas that appear within the last parameter of a command do not need to be escaped because the program knows to treat them literally. The same is generally true for all parameters of <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a> because it has smart comma handling.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`%</td>
<td class="calibre4">% (literal percent)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">``</td>
<td class="calibre4">` (accent, i.e. two consecutive escape characters result in a single literal character)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`;</td>
<td class="calibre4">; (literal semicolon) Note: It's necessary to escape semicolons <u class="calibre20">only</u> if they have a space or tab to their left.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`::</td>
<td class="calibre4">A literal pair of colons.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`n</td>
<td class="calibre4">newline (linefeed/LF)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`r</td>
<td class="calibre4">carriage return (CR)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`b</td>
<td class="calibre4">backspace</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`t</td>
<td class="calibre4">tab (the more typical horizontal variety)</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`v</td>
<td class="calibre4"> vertical tab -- corresponds to Ascii value 11. It can also be manifest in some applications by typing Control+K.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`a</td>
<td class="calibre4">alert (bell) -- corresponds to Ascii value 7. It can also be manifest in some applications by typing Control+G.</td>
</tr>
<tr class="calibre3">
<td class="calibre4">`f</td>
<td class="calibre4">formfeed -- corresponds to Ascii value 12. It can also be manifest in some applications by typing Control+L.</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> The following rarely used directives also exist; their usage is shown in these examples: <br class="calibre12" /> #DerefChar # ; Change it from its normal default, which is % <br class="calibre12" /> #Delimiter / ; Change it from its normal default, which is comma. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p> #EscapeChar \ ; Change it to be the same as AutoIt2's.<br class="calibre12" />
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="h_MaxMem.htm" href="#h_MaxMem.htm">#</a> <h2 class="calibre17">#MaxMem</h2> [v1.0.19+]
<hr size="2" class="calibre24" />
<p class="calibre8">Sets the the maximum capacity of each <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> to the specified number of megabytes.</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#MaxMem Megabytes </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td width="15%" class="calibre4">Megabytes</td>
<td width="85%" class="calibre4">The number of megabytes to allow for each <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a>. A value larger than 4095 is considered to be 4095. A value less than 1 is considered to be 1. </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8">If this directive is unspecified in the script, it will behave as though set to 64.</p>
<p class="calibre8">The purpose of limiting each variable's capacity is to prevent a buggy script from consuming all available system memory. Raising or lowering the limit does not affect the performance of a script, nor does it change how much memory the script actually uses (except in the case of <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a> and <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, which will be capable of retrieving more text if #MaxMem is increased).</p>
<p class="calibre8">This setting is global, meaning that it needs to be specified only once (anywhere in the script) to affect the behavior of the entire script.</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"> <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Variables</a>, <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a>, <a href="#WinGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGetText</a>, <a href="#ControlGetText.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlGetText</a>, <a href="#h_MaxThreads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreads</a></p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong> </p>
<p class="calibre8"> #MaxMem 256 ; Allow 256 MB per variable. <br class="calibre12" />
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="h_Persistent.htm" href="#h_Persistent.htm">#</a> <h2 class="calibre17">#Persistent</h2> [v1.0.09+]
<hr size="2" class="calibre24" />
<p class="calibre8">Keeps a non-hotkey script permanently running (that is, until <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> is encountered).</p>
<table cellspacing="5" width="100%" class="calibre28">
<tbody class="calibre2">
<tr class="calibre3">
<td height="48" class="calibre4">#Persistent</td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Parameters</strong></p>
<p class="calibre8">None</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Remarks</strong></p>
<p class="calibre8"> If this directive is present anywhere in the script, that script will stay running after the auto-execute section (top part) of the script completes. This is useful in cases where a script contains <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timers</a> and/or <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu items</a> but not <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkeys</a>, <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstrings</a>, or any use of the <a href="#Gui.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Gui</a> command.</p>
<p class="calibre8">If this directive is added to an existing script, you might want to change some or all occurrences of <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a> to be <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a>. This is because <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a> will not terminate a persistent script; it terminates only the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a>.</p>
<p class="calibre8">In v1.0.16+, this directive also makes scripts <a href="#h_SingleInstance.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#SingleInstance </a>unless <em class="calibre21">#SingleInstance Off</em> has been specified.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Related</strong></p>
<p class="calibre8"><a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a>, <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a>, <a href="#Exit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Exit</a>, <a href="#ExitApp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ExitApp</a> </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<p class="calibre8">#Persistent</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Acknowledgements.htm" href="#Acknowledgements.htm">#</a>
<h2 class="calibre9">Acknowledgements</h2>
<p class="calibre8"> In addition to the AutoIt authors already <a href="#AutoHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">mentioned</a>:</p>
<p class="calibre8"><strong class="calibre14">Robert Yaklin</strong>: A lot of tireless testing to isolate bugs, a great first draft of the installer, as well as great suggestions for how commands <strong class="calibre14">ought</strong> to work :) </p>
<p class="calibre8"><strong class="calibre14">Jason Payam Ahdoot</strong>: For suggesting and describing floating point support. </p>
<p class="calibre8"><strong class="calibre14">Jay D. Novak</strong>: For discovering many Win9x problems with the Send command, Capslock, and hotkey modifiers; and for generously sharing his wealth of code and wisdom for hotkeys, hot-strings, hook usage, and typing acceleration.</p>
<p class="calibre8"><strong class="calibre14">Rajat</strong>: For creating stylish replacements for the original AHK icons; a great product logo; making the syntax customizations for TextPad; discovering some bugs with the registry commands and AutoIt v2 compatibility; making SmartGUI Creator; and many other things.</p>
<p class="calibre8"><strong class="calibre14">beardboy</strong>: For NT4 testing to fix GetKeyState and the Send command; for a lot of help on the forum; and for many suggestions and bug reports.</p>
<p class="calibre8"> <strong class="calibre14">Gregory F. Hogg of Hogg's Software</strong>: For writing the source code for multi-monitor support in the SysGet command.</p>
<p class="calibre8"> </p>
<p class="calibre8"><em class="calibre21">And to everyone else who's sent in bug reports or suggestions: Thanks!</em></p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Arrays.htm" href="#Arrays.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Arrays</span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">In AutoHotkey, arrays are mostly conceptual: Each array is really just a collection of sequentially numbered <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variables</a>, with each variable being perceived by the user as an <em class="calibre21">element</em> of the array. AutoHotkey does not link these variables together in any way.</p>
<p class="calibre8">In addition to <a href="#StringSplit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringSplit</a> and <a href="#WinGet.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">WinGet</a>, any command that accepts an OutputVar or that assigns a value to a variable can be used to create an array. Once created, a command such as <a href="#StringTrimLeft.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">StringTrimLeft</a> is usually used to access the individual elements. </p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">; Write to the array:
loop, 5
{
Random, array%a_index%, 1, 100 ; Put a random number into each element.
}
; Read from the array:
loop
{
StringTrimRight, element, array%a_index%, 0
if element =
break ; The end of the array has been reached.
MsgBox, %element%
}</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Clipboard.htm" href="#Clipboard.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Clipboard</span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">This is a built-in <a href="#Variables.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">variable</a> that reflects the current contents of the Windows clipboard if those contents can be expressed as text.</p>
<p class="calibre8">Files (such as those copied from an open Explorer window with Control-C) are considered to be text: They are auto-converted to their filenames (with full path) whenever the clipboard variable is referenced in the script. Each filename except the last is terminated by a <span class="rm">carriage return and</span> linefeed (<span class="rm">CR+</span>LF), which can be expressed in the script as <span class="rm">`r</span>`n.</p>
<p class="calibre8">See the examples section of <a href="#LoopParse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">parsing loop</a> for an easy method of extracting the individual filenames from the clipboard. To arrange the filenames in alphabetical order, use the <a href="#Sort.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Sort</a> command. To write the filenames on the clipboard to a file via <a href="#FileAppend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileAppend</a><span class="rm">, first replace `r`n with `n as in this example:</span></p>
<p class="calibre8"> <span class="rm">StringReplace, clipboard, clipboard, `r`n, `n, All</span> <br class="calibre12" /> FileAppend, %clipboard%`n, C:\My File.txt<br class="calibre12" />
<br class="calibre12" />
<strong class="calibre14">Other Examples<br class="calibre12" />
</strong>clipboard = my text ; Give the clipboard entirely new contents.<br class="calibre12" /> clipboard = ; Empty the clipboard.<br class="calibre12" /> clipboard = %clipboard% Text to append. ; Append some text to the clipboard.<br class="calibre12" /> StringReplace, clipboard, clipboard, ABC, DEF, All ; Replace all occurrences of ABC with DEF.
</p>
<p class="calibre8"> </p>
<p class="calibre8">; This next example uses Control-C to copy, then displays the selected files or text:</p>
<p class="calibre8">clipboard =<br class="calibre12" /> Send, ^c<br class="calibre12" />
<a href="#ClipWait.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ClipWait</a><br class="calibre12" /> MsgBox, Control-C copied the following contents to the clipboard:`n`n%clipboard%
</p>
</div>
</div>
<div class="calibreMain tbd">
<div class="calibreEbookContent">
<a id="ContextSensitiveHelp.htm" href="#ContextSensitiveHelp.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Context Sensitive Help in Any Editor -- by Rajat</h3>
<div class="calibre46">
<p class="calibre47"> This script Makes Ctrl+2 show the help file section for the selected command or keyword. If nothing is selected, the command name will be extracted from the editor's current line. </p>
<p class="calibre47"><a href="ContextSensitiveHelp.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">$^2::
; If desired, uncomment and adjust the section below to make this hotkey
; operate only when a certain editor is active and/or it has a script file open.
/*
; Do it this way to avoid the case sensitivity of IfWinNotActive:
WinGetTitle, ActiveTitle, A
if ActiveTitle not contains .ahk ; A script does not appear to be open.
{
send, ^2
return
}
*/
if a_OSType = WIN32_WINDOWS ; Windows 9x
Sleep, 500 ; Give time for the user to release the key.
clipboard_prev = %clipboard%
clipboard =
; Use the highlighted word if there is one (since sometimes the user might
; intentionally highlight something that isn't a command):
Send, ^c
ClipWait, 0.05
if ErrorLevel &lt;&gt; 0
{
; Get the entire line because editors treat cursor navigation keys differently:
Send, {home}+{end}^c
ClipWait, 0.2
if ErrorLevel &lt;&gt; 0 ; Rare, so no error is reported.
{
clipboard = %clipboard_prev%
return
}
}
AutoTrim, on ; Make sure it's at its default setting.
cmd = %clipboard% ; This will trim leading and trailing tabs &amp; spaces.
clipboard = %clipboard_prev% ; Restore the original clipboard for the user.
Loop, parse, cmd, %a_space%`, ; The first space or comma is the end of the command.
{
cmd = %a_LoopField%
break ; i.e. we only need one interation.
}
IfWinNotExist, AutoHotkey Help
{
; Use non-abbreviated root key to support older versions of AHK:
RegRead, ahk_dir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
if ErrorLevel &lt;&gt; 0
{
; Older versions of AHK might not have the above registry entry,
; so use a best guess location instead:
ahk_dir = %ProgramFiles%\AutoHotkey
}
ahk_help_file = %ahk_dir%\AutoHotkey.chm
IfNotExist, %ahk_help_file%
{
MsgBox, Could not find the help file: %ahk_help_file%.
return
}
Run, %ahk_help_file%
WinWait, AutoHotkey Help
}
; The above has set the "last found" window which we use below:
WinActivate
WinWaitActive
StringReplace, cmd, cmd, #, {#}
send, !n{home}+{end}%cmd%{enter}
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="EasyWindowDrag.htm" href="#EasyWindowDrag.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Easy Window Dragging (requires XP/2k/NT)</h3>
<div class="calibre46">
<p class="calibre47"> Normally, a window can only be dragged by clicking on its title bar. This script extends that so that any point inside a window can be dragged. To activate this mode, hold down CapsLock or the middle mouse button while clicking, then drag the window to a new position. </p>
<p class="calibre47"><a href="EasyWindowDrag.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">; Note: You can optionally release Capslock or the middle mouse button after
; the first click rather than holding it down the whole time.
~MButton &amp; LButton::
CapsLock &amp; LButton::
CoordMode, Mouse ; Switch to screen/absolute coordinates.
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
return
EWD_WatchMouse:
GetKeyState, LButtonState, LButton, P
if LButtonState = U ; Button has been released, so drag is complete.
{
SetTimer, EWD_WatchMouse, off
return
}
; Otherwise, reposition the window to match the change in mouse coordinates
; caused by the user having dragged the mouse:
CoordMode, Mouse
MouseGetPos, EWD_MouseX, EWD_MouseY
EWD_DeltaX = %EWD_MouseX%
EWD_DeltaX -= %EWD_MouseStartX%
EWD_DeltaY = %EWD_MouseY%
EWD_DeltaY -= %EWD_MouseStartY%
EWD_MouseStartX = %EWD_MouseX% ; Update for the next timer call to this subroutine.
EWD_MouseStartY = %EWD_MouseY%
WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
EWD_WinX += %EWD_DeltaX%
EWD_WinY += %EWD_DeltaY%
SetWinDelay, -1 ; Makes the below move faster/smoother.
WinMove, ahk_id %EWD_MouseWin%,, %EWD_WinX%, %EWD_WinY%
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="ErrorLevel.htm" href="#ErrorLevel.htm">#</a>
<h2 class="calibre9"><span class="calibre23">ErrorLevel</span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">This is a built-in variable that is set to indicate the success or failure of some of the commands (not all commands change the value of ErrorLevel). A value of 0 usually indicates success, and any other value usually indicates failure. You can also set the value of ErrorLevel yourself.</p>
<p class="calibre8">Of special interest is that <a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> sets ErrorLevel to be the exit code of the program it ran. Most programs yield an exit code of zero if they completed successfully. </p>
<p class="calibre8">Each <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">thread</a> retains its own value of ErrorLevel, meaning that if the <a href="#Threads.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">current thread</a> is interrupted by another, when the original thread is resumed it will still have its original value of ErrorLevel, not the ErrorLevel that may have been set by the interrupting thread.</p>
<p class="calibre8">Note: Since some commands set ErrorLevel to values higher than 1, it is best not check whether ErrorLevel is 1, but instead whether ErrorLevel is not zero.</p>
<p class="calibre8"> </p>
<p class="calibre8"><strong class="calibre14">Example</strong></p>
<pre class="calibre22">WinWait, MyWindow, , 1
if ErrorLevel &lt;&gt; 0
MsgBox, The window does not exist.
else
MsgBox, The window exists.</pre>
</div>
</div>
<div class="calibreMain x11">
<div class="calibreEbookContent">
<a id="Accessibility.htm" href="#Accessibility.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Commands based on Accessibility</span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Some commands, such as ControlSend or the ExcludeText of window matching options, can only work if accessibility information (AT-SPI) is available. This is the only way to make them work. This means that <b>on the computer where the script is run</b>, 1. at-spi2 needs to be installed, 2. assistive technologies need to be enabled (distribution setting), 3. several applications such as Chrome need special configuration flags. You can verify if a window properly works with at-spi with Window Spy ("Focused Control"). Most windows work, but these are the steps every user of your script may need to take:</p>
<pre>
- Enable the assistive technologies setting for your distribution. There's usually a single checkbox somewhere to be found to enable it. After enabling, you need to reboot.
- If the window is a Chromium-based browser such as Chrome or Brave or an Electron-based application such as VSCode, Slack, Spotify, Discord and many more (www.electronjs.org/apps), it needs to be launched with two tweaks:
1. Set environment variable ACCESSIBILITY_ENABLED to value 1. You can e.g. enable this globally by adding another line with content ACCESSIBILITY_ENABLED=1 into the file /etc/environment and then restarting your computer.
2. Add argument --force-renderer-accessibility. You can do so by editing the program's \"Desktop file\", or starting it from command line and passing it there.
Example for Chrome:
export ACCESSIBILITY_ENABLED=1
chrome --force-renderer-accessibility
- If the window is a Java application, you need to install the ATK bridge: For Debian-based applications, this is libatk-wrapper-java. For Arch Linux based ones, it's java-atk-wrapper-openjdk8 (depending on the Java version)
- In the rare case that the window is an exotic, old application built with Qt4, such as some programs that haven't been maintained since 2015, you need to install qt-at-spi.
- According to the internet, these following environment variables may also help: GNOME_ACCESSIBILITY=1, QT_ACCESSIBILITY=1, GTK_MODULES=gail:atk-bridge and QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1. This is probably only relevant for outdated programs too, if ever.
- If you tried all of that and it still doesn't work, this program may not support control access at all. Please consider opening up an issue at github.com/phil294/ahk_x11 so we can investigate. Almost every program out there will work some way or another!
- Most games and programs built with Tk (rare) usually never work.
</pre>
<hr/>
<p class="calibre8">Another thing to note: While all these accessibility-related commands usually perform reasonably fast, the *very first* usage of any such command will bootstrap the protocol. This can take a while, sometimes *multiple seconds*.</p>
</div>
</div>
<div class="tbd">
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="FavoriteFolders.htm" href="#FavoriteFolders.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Easy Access to Favorite Folders -- by Savage</h3>
<div class="calibre46">
<p class="calibre47"> When you click the middle mouse button while certain types of windows are active, this script displays a menu of your favorite folders. Upon selecting a favorite, the script will instantly switch to that folder within the active window. The following window types are supported: 1) Standard file-open or file-save dialogs; 2) Explorer windows; 3) Console (command prompt) windows. The menu can also be optionally shown for unsupported window types, in which case the chosen favorite will be opened as a new Explorer window. </p>
<p class="calibre47"><a href="FavoriteFolders.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">; Note: In Windows Explorer, if "View &gt; Toolbars &gt; Address Bar" is
; not enabled, the menu will not be shown if the hotkey chosen below
; has a tilde. If it does have a tilde, the menu will be shown
; but the favorite will be opened in a new Explorer window rather
; than switching the active Explorer window to that folder.
; CONFIG: CHOOSE YOUR HOTKEY
; If your mouse has more than 3 buttons, you could try using
; XButton1 (the 4th) or XButton2 (the 5th) instead of MButton.
; You could also use a modified mouse button (such as ^MButton) or
; a keyboard hotkey. In the case of MButton, the tilde (~) prefix
; is used so that MButton's normal functionality is not lost when
; you click in other window types, such as a browser. The presence
; of a tilde tells the script to avoid showing the menu for
; unsupported window types. In other words, if there is no tilde,
; the hotkey will always display the menu; and upon selecting a
; favorite while an unsupported window type is active, a new
; Explorer window will be opened to display the contents of that
; folder.
f_Hotkey = ~MButton
; CONFIG: CHOOSE YOUR FAVORITES
; Update the special commented section below to list your favorite
; folders. Specify the name of the menu item first, followed by a
; semicolon, followed by the name of the actual path of the favorite.
; Use a blank line to create a separator line.
/*
ITEMS IN FAVORITES MENU &lt;-- Do not change this string.
Desktop ; %UserProfile%\Desktop
Favorites ; %UserProfile%\Favorites
My Documents ; %UserProfile%\My Documents
Program Files; %ProgramFiles%
*/
; END OF CONFIGURATION SECTION
; Do not make changes below this point unless you want to change
; the basic functionality of the script.
#SingleInstance ; Needed since the hotkey is dynamically created.
Hotkey, %f_Hotkey%, f_DisplayMenu
StringLeft, f_HotkeyFirstChar, f_Hotkey, 1
if f_HotkeyFirstChar = ~ ; Show menu only for certain window types.
f_AlwaysShowMenu = n
else
f_AlwaysShowMenu = y
; Used to reliably determine whether script is compiled:
SplitPath, A_ScriptName,,, f_FileExt
if f_FileExt = Exe ; Read the menu items from an external file.
f_FavoritesFile = %A_ScriptDir%\Favorites.ini
else ; Read the menu items directly from this script file.
f_FavoritesFile = %A_ScriptFullPath%
;----Read the configuration file.
f_AtStartingPos = n
f_MenuItemCount = 0
Loop, Read, %f_FavoritesFile%
{
if f_FileExt &lt;&gt; Exe
{
; Since the menu items are being read directly from this
; script, skip over all lines until the starting line is
; arrived at.
if f_AtStartingPos = n
{
IfInString, A_LoopReadLine, ITEMS IN FAVORITES MENU
f_AtStartingPos = y
continue ; Start a new loop iteration.
}
; Otherwise, the closing comment symbol marks the end of the list.
if A_LoopReadLine = */
break ; terminate the loop
}
; Menu separator lines must also be counted to be compatible
; with A_ThisMenuItemPos:
f_MenuItemCount++
if A_LoopReadLine = ; Blank indicates a separator line.
Menu, Favorites, Add
else
{
StringSplit, f_line, A_LoopReadLine, `;
f_line1 = %f_line1% ; Trim leading and trailing spaces.
f_line2 = %f_line2% ; Trim leading and trailing spaces.
; Resolve any references to variables within either field, and
; create a new array element containing the path of this favorite:
Transform, f_path%f_MenuItemCount%, deref, %f_line2%
Transform, f_line1, deref, %f_line1%
Menu, Favorites, Add, %f_line1%, f_OpenFavorite
}
}
return ;----End of auto-execute section.
;----Open the selected favorite
f_OpenFavorite:
; Fetch the array element that corresponds to the selected menu item:
StringTrimLeft, f_path, f_path%A_ThisMenuItemPos%, 0
if f_path =
return
if f_class = #32770 ; It's a dialog.
{
if f_Edit1Pos &lt;&gt; ; And it has an Edit1 control.
{
; Activate the window so that if the user is middle-clicking
; outside the dialog, subsequent clicks will also work:
WinActivate ahk_id %f_window_id%
; Retrieve any filename that might already be in the field so
; that it can be restored after the switch to the new folder:
ControlGetText, f_text, Edit1, ahk_id %f_window_id%
ControlSetText, Edit1, %f_path%, ahk_id %f_window_id%
ControlSend, Edit1, {Enter}, ahk_id %f_window_id%
Sleep, 100 ; It needs extra time on some dialogs or in some cases.
ControlSetText, Edit1, %f_text%, ahk_id %f_window_id%
return
}
; else fall through to the bottom of the subroutine to take standard action.
}
else if f_class in ExploreWClass,CabinetWClass ; In Explorer, switch folders.
{
if f_Edit1Pos &lt;&gt; ; And it has an Edit1 control.
{
ControlSetText, Edit1, %f_path%, ahk_id %f_window_id%
; Tekl reported the following: "If I want to change to Folder L:\folder
; then the addressbar shows http://www.L:\folder.com. To solve this,
; I added a {right} before {Enter}":
ControlSend, Edit1, {Right}{Enter}, ahk_id %f_window_id%
return
}
; else fall through to the bottom of the subroutine to take standard action.
}
else if f_class = ConsoleWindowClass ; In a console window, CD to that directory
{
WinActivate, ahk_id %f_window_id% ; Because sometimes the mclick deactivates it.
SetKeyDelay, 0 ; This will be in effect only for the duration of this thread.
IfInString, f_path, : ; It contains a drive letter
{
StringLeft, f_path_drive, f_path, 1
Send %f_path_drive%:{enter}
}
Send, cd %f_path%{Enter}
return
}
; Since the above didn't return, one of the following is true:
; 1) It's an unsupported window type but f_AlwaysShowMenu is y (yes).
; 2) It's a supported type but it lacks an Edit1 control to facilitate the custom
; action, so instead do the default action below.
Run, Explorer %f_path% ; Might work on more systems without double quotes.
return
;----Display the menu
f_DisplayMenu:
; These first few variables are set here and used by f_OpenFavorite:
WinGet, f_window_id, ID, A
WinGetClass, f_class, ahk_id %f_window_id%
if f_class in #32770,ExploreWClass,CabinetWClass ; Dialog or Explorer.
ControlGetPos, f_Edit1Pos,,,, Edit1, ahk_id %f_window_id%
if f_AlwaysShowMenu = n ; The menu should be shown only selectively.
{
if f_class in #32770,ExploreWClass,CabinetWClass ; Dialog or Explorer.
{
if f_Edit1Pos = ; The control doesn't exist, so don't display the menu
return
}
else if f_class &lt;&gt; ConsoleWindowClass
return ; Since it's some other window type, don't display menu.
}
; Otherwise, the menu should be presented for this type of window:
Menu, Favorites, show
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="HotkeyFeatures.htm" href="#HotkeyFeatures.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Advanced Hotkey Features </span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Users of Windows NT/2000/XP and beyond may take advantage of the following additional features, some of which are unique to AutoHotkey and not available even in the most powerful commercial hotkey software.<br class="calibre12" />
<br class="calibre12" />
<u class="calibre20">Some of the easiest keys to reach</u> on the keyboard are also the least frequently used. Make these keys do something useful! For example, if you rarely use the right ALT key, make it perform the action you do most often:<br class="calibre12" /> RAlt::<br class="calibre12" /> MsgBox You pressed the right ALT key.<br class="calibre12" /> return
</p>
<p class="calibre8">You can even do the above without losing Right-ALT's native function by assigning Right-ALT to be a "prefix" for at least one other hotkey. In the below example, Right-ALT has become a prefix, which automatically allows it to modify <strong class="calibre14">all</strong> other keys as it normally would. But if you press and release Right-Alt without having used it to modify another key, its hotkey action (above) will take effect immediately:<br class="calibre12" /> RAlt &amp; j::AltTab</p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20">Don't be limited to using only CTRL, ALT, SHIFT, and WIN</u> as modifiers; you can combine <strong class="calibre14">any</strong> two keys or mouse buttons to form a custom hotkey. For example: Hold down Numpad0 and press Numpad1 to launch a hotkey (syntax: Numpad0 &amp; Numpad1::); hold down CapsLock and press another key, or click a mouse button (syntax: CapsLock &amp; RButton::). In this case, the state of the CapsLock key is not changed when it is used to launch the hotkey.</p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20"><a id="HotkeyFeatures.htm__AltTab" href="#HotkeyFeatures.htm__AltTab" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#</a> Convert the mouse wheel</u> (or any other keys of your choice) into a complete substitute for Alt-Tab. Click the wheel to show or hide the menu, and turn it to navigate through the menu. The wheel will still function normally whenever the Alt-Tab menu isn't visible. Syntax:<br class="calibre12" /> MButton::AltTabMenu<br class="calibre12" /> WheelDown::AltTab<br class="calibre12" /> WheelUp::ShiftAltTab</p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20">Make a keyboard key <strong class="calibre14">become</strong> a mouse button</u>, or have an action repeated continuously while you're holding down a key or mouse button. See example at the bottom of the <a href="#GetKeyState.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">GetKeyState</a> page. </p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20">Make your hotkeys </u><u class="calibre20">context-sensitive</u>: Have your easiest-to-reach hotkeys perform an action appropriate to the type of window you're working with. For example:<br class="calibre12" /> RControl::<br class="calibre12" /> IfWinActive, Untitled - Notepad<br class="calibre12" /> {<br class="calibre12" />    WinMenuSelectItem, , , File, Save<br class="calibre12" /> }<br class="calibre12" /> else IfWinActive, Calculator<br class="calibre12" /> {<br class="calibre12" />    Send, ^c!{tab}<br class="calibre12" /> }<br class="calibre12" /> return</p>
<p class="calibre8"> </p>
<p class="calibre8"><u class="calibre20">Hot-strings: Define abbreviations that expand as you type them (auto-replace)</u>. No special training or scripting experience is needed. For example, a script containing the following lines would expand ceo, cfo, and btw wherever you type them:</p>
<p class="calibre8">::ceo::Chief Executive Officer<br class="calibre12" /> ::cfo::Chief Financial Officer<br class="calibre12" /> ::btw::by the way</p>
<p class="calibre8"><a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">(more details)</a><br class="calibre12" />
</p>
<p class="calibre8">  </p>
<p class="calibre8"><strong class="calibre14"><u class="calibre20">Gamers, rejoice!</u></strong></p>
<ul class="calibre10">
<li class="calibre11">Reduce wear &amp; tear on your fingers by using virtually <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">any key</a> as a hotkey, including single letters, arrow keys, Numpad keys, and even the modifier keys themselves (CTRL/ALT/WIN/SHIFT).</li>
<li class="calibre11">Create mouse hotkeys, including the mouse wheel button (MButton) and the turning of the wheel up and down (WheelUp and WheelDown). You can also combine a keyboard key with a mouse button. For example, control-left-button would be expressed as ^LButton::</li>
<li class="calibre11">Create "pass-through" hotkeys. For example, the left mouse button can trigger a hotkey action even while the click itself is being sent into the game normally (syntax: ~LButton::).</li>
<li class="calibre11">Use commands such as <a href="#PixelSearch.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelSearch</a> and <a href="#PixelGetColor.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">PixelGetColor</a> to automate game actions.</li>
<li class="calibre11">Have the option of using the <a href="#h_UseHook.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">keyboard hook</a> to implement hotkeys, which might be more responsive than other hotkey methods while the CPU is under load in a game. The hook might also be able to override any restrictions a game may have about which keys can be "mapped" to game actions.</li>
</ul>
<p class="calibre8">See the <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkeys</a> section for more detailed information. </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="index.htm" href="#index.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">AutoHotkey Script Showcase</h3>
<div class="calibre46">
<p class="calibre47"><a href="#ContextSensitiveHelp.htm">Context Sensitive Help in Any Editor -- by Rajat</a>: This script Makes Ctrl+2 show the help file section for the selected command or keyword. If nothing is selected, the command name will be extracted from the editor's current line. </p>
<p class="calibre47"><a href="#EasyWindowDrag.htm">Easy Window Dragging (requires XP/2k/NT)</a>: Normally, a window can only be dragged by clicking on its title bar. This script extends that so that any point inside a window can be dragged. To activate this mode, hold down CapsLock or the middle mouse button while clicking, then drag the window to a new position. </p>
<p class="calibre47"><a href="#FavoriteFolders.htm">Easy Access to Favorite Folders -- by Savage</a>: When you click the middle mouse button while certain types of windows are active, this script displays a menu of your favorite folders. Upon selecting a favorite, the script will instantly switch to that folder within the active window. The following window types are supported: 1) Standard file-open or file-save dialogs; 2) Explorer windows; 3) Console (command prompt) windows. The menu can also be optionally shown for unsupported window types, in which case the chosen favorite will be opened as a new Explorer window. </p>
<p class="calibre47"><a href="#JoystickMouse.htm">Using a Joystick as a Mouse</a>: This script converts a joystick into a two-button mouse. It allows each button to drag just like a mouse button and it uses virtually no CPU time. Also, it will move the cursor faster depending on how far you push the joystick from center. You can personalize various settings at the top of the script. </p>
<p class="calibre47"><a href="#JoystickTest.htm">Joystick Test Script</a>: This script might help determine the button numbers of your joystick. It might also reveal if your joystick is in need of calibration, that is, whether the range of motion of each of its axes is from 0 to 100 percent as it should be. If calibration is needed, use the operating system's control panel or the software that came with your joystick. </p>
<p class="calibre47"><a href="#KeyboardOnScreen.htm">On-Screen Keyboard (requires XP/2k/NT) -- by Jon</a>: This script creates a mock keyboard at the bottom of your screen that shows the keys you are pressing in real time. I made it to help me to learn to touch-type (to get used to not looking at the keyboard). The size of the on-screen keyboard can be customized at the top of the script. Also, you can double-click the tray icon to show or hide the keyboard. </p>
<p class="calibre47"><a href="#MinimizeToTrayMenu.htm">Minimize Window to Tray Menu</a>: This script assigns a hotkey of your choice to hide any window so that it becomes an entry at the bottom of the script's tray menu. Hidden windows can then be restored individually or all at once by selecting the corresponding item on the menu. If the script exits for any reason, all the windows that it hid will be restored automatically. </p>
<p class="calibre47"><a href="#MsgBoxButtonNames.htm">Changing MsgBox's Button Names</a>: This is a working example script that uses a timer to change the names of the buttons in a MsgBox dialog. Although the button names are changed, the IfMsgBox command still requires that the buttons be referred to by their original names. </p>
<p class="calibre47"><a href="#Numpad000.htm">Numpad 000 Key</a>: This example script makes the special 000 key that appears on certain keypads into an equals key. You can change the action by replacing the “Send, =” line with line(s) of your choice. </p>
<p class="calibre47"><a href="#NumpadMouse.htm">Using Keyboard Numpad as a Mouse -- by deguix</a>: This script makes mousing with your keyboard almost as easy as using a real mouse (maybe even easier for some tasks). It supports up to five mouse buttons and the turning of the mouse wheel. It also features customizable movement speed, acceleration, and "axis inversion". </p>
<p class="calibre47"><a href="#Seek_Search.htm">Seek -- by Phi</a>: Navigating the Start Menu can be a hassle, especially if you have installed many programs over time. 'Seek' lets you specify a case-insensitive key word/phrase that it will use to filter only the matching programs and directories from the Start Menu, so that you can easily open your target program from a handful of matched entries. This eliminates the drudgery of searching and traversing the Start Menu. </p>
<p class="calibre47"><a href="#TooltipMouseMenu.htm">ToolTip Mouse Menu (requires XP/2k/NT) -- by Rajat</a>: This script displays a popup menu in response to briefly holding down the middle mouse button. Select a menu item by left-clicking it. Cancel the menu by left-clicking outside of it. A recent improvement is that the contents of the menu can change depending on which type of window is active (Notepad and Word are used as examples here). </p>
<p class="calibre47"><a href="#VolumeOSD.htm">Volume On-Screen-Display (OSD) -- by Rajat</a>: This script assigns hotkeys of your choice to raise and lower the master and/or wave volume. Both volumes are displayed as different color bar graphs. </p>
<p class="calibre47"><a href="#WindowShading.htm">Window Shading (roll up a window to its title bar) -- by Rajat</a>: This script reduces a window to its title bar and then back to its original size by pressing a single hotkey. Any number of windows can be reduced in this fashion (the script remembers each). If the script exits for any reason, all "rolled up" windows will be automatically restored to their original heights. </p>
<a href="http://www.autohotkey.com">-- Home --</a>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="JoystickMouse.htm" href="#JoystickMouse.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Using a Joystick as a Mouse</h3>
<div class="calibre46">
<p class="calibre47"> This script converts a joystick into a two-button mouse. It allows each button to drag just like a mouse button and it uses virtually no CPU time. Also, it will move the cursor faster depending on how far you push the joystick from center. You can personalize various settings at the top of the script. </p>
<p class="calibre47"><a href="JoystickMouse.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">; Increase this value to make the mouse cursor move faster:
JoyMultiplier = 0.40
; Decrease this value to require less joystick displacement-from-center
; to start moving the mouse. However, you may need to calibrate your
; joystick -- ensuring it's properly centered -- to avoid cursor drift.
; A perfectly tight and centered joystick could use a value of 1:
JoyThreshold = 3
; Change these values to use joystick button numbers other than 1 &amp; 2 for the
; left &amp; right mouse buttons, respectively:
ButtonLeft = 1
ButtonRight = 2
; If your system has more than one joystick, increase this value to use a joystick
; other than the first:
JoystickNumber = 1
; END OF CONFIG SECTION -- Don't change anything below this point unless you want
; to alter the basic nature of the script.
#SingleInstance
Hotkey, %JoystickNumber%Joy%ButtonLeft%, ButtonLeft
Hotkey, %JoystickNumber%Joy%ButtonRight%, ButtonRight
; Calculate the axis displacements that are needed to start moving the cursor:
JoyThresholdUpper = 50
JoyThresholdUpper += %JoyThreshold%
JoyThresholdLower = 50
JoyThresholdLower -= %JoyThreshold%
SetTimer, WatchJoystick, 10 ; Monitor the movement of the joystick.
return ; End of auto-execute section.
; The subroutines below do not use KeyWait because that would sometimes trap the
; WatchJoystick quasi-thread beneath the wait-for-button-up thread, which would
; effectively prevent mouse-dragging with the joystick.
ButtonLeft:
SetMouseDelay, -1 ; Makes movement smoother.
MouseClick, left,,, 1, 0, D ; Hold down the left mouse button.
SetTimer, WaitForLeftButtonUp, 10
return
ButtonRight:
SetMouseDelay, -1 ; Makes movement smoother.
MouseClick, right,,, 1, 0, D ; Hold down the right mouse button.
SetTimer, WaitForRightButtonUp, 10
return
WaitForLeftButtonUp:
GetKeyState, jstate1, %JoystickNumber%Joy%ButtonLeft%
if jstate1 = D ; The button is still, down, so keep waiting.
return
; Otherwise, the button has been released.
SetTimer, WaitForLeftButtonUp, off
SetMouseDelay, -1 ; Makes movement smoother.
MouseClick, left,,, 1, 0, U ; Release the mouse button.
return
WaitForRightButtonUp:
GetKeyState, jstate2, %JoystickNumber%Joy%ButtonRight%
if jstate2 = D ; The button is still, down, so keep waiting.
return
; Otherwise, the button has been released.
SetTimer, WaitForRightButtonUp, off
MouseClick, right,,, 1, 0, U ; Release the mouse button.
return
WatchJoystick:
MoveMouse? = n ; Set default.
SetFormat, float, 03
GetKeyState, joyx, %JoystickNumber%JoyX
GetKeyState, joyy, %JoystickNumber%JoyY
if joyx &gt; %JoyThresholdUpper%
{
MoveMouse? = y
DeltaX = %joyx%
DeltaX -= %JoyThresholdUpper%
}
else if joyx &lt; %JoyThresholdLower%
{
MoveMouse? = y
DeltaX = %joyx%
DeltaX -= %JoyThresholdLower%
}
else
DeltaX = 0
if joyy &gt; %JoyThresholdUpper%
{
MoveMouse? = y
DeltaY = %joyy%
DeltaY -= %JoyThresholdUpper%
}
else if joyy &lt; %JoyThresholdLower%
{
MoveMouse? = y
DeltaY = %joyy%
DeltaY -= %JoyThresholdLower%
}
else
DeltaY = 0
if MoveMouse? = y
{
DeltaX *= %JoyMultiplier%
DeltaY *= %JoyMultiplier%
SetMouseDelay, -1 ; Makes movement smoother.
MouseMove, %DeltaX%, %DeltaY%, 0, R
}
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="JoystickTest.htm" href="#JoystickTest.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Joystick Test Script</h3>
<div class="calibre46">
<p class="calibre47"> This script might help determine the button numbers of your joystick. It might also reveal if your joystick is in need of calibration, that is, whether the range of motion of each of its axes is from 0 to 100 percent as it should be. If calibration is needed, use the operating system's control panel or the software that came with your joystick. </p>
<p class="calibre47"><a href="JoystickTest.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">#SingleInstance
SetFormat, float, 03 ; Omit decimal point from axis position percentages.
JoystickNumber = 1 ; Increase this to test a joystick other than the first.
GetKeyState, axis_count, %JoystickNumber%JoyAxes
if axis_count &lt; 1
{
MsgBox Joystick #%JoystickNumber% does not appear to be attached to the system.
ExitApp
}
GetKeyState, joy_buttons, %JoystickNumber%JoyButtons
GetKeyState, joy_name, %JoystickNumber%JoyName
GetKeyState, joy_info, %JoystickNumber%JoyInfo
GetKeyState, joy_axes, %JoystickNumber%JoyAxes
Loop
{
buttons_down =
Loop, %joy_buttons%
{
GetKeyState, joy%a_index%, %JoystickNumber%joy%a_index%
if joy%a_index% = D
buttons_down = %buttons_down%%a_space%%a_index%
}
GetKeyState, joyx, %JoystickNumber%JoyX
axis_info = X%joyx%
GetKeyState, joyy, %JoystickNumber%JoyY
axis_info = %axis_info%%a_space%%a_space%Y%joyy%
IfInString, joy_info, Z
{
GetKeyState, joyz, %JoystickNumber%JoyZ
axis_info = %axis_info%%a_space%%a_space%Z%joyz%
}
IfInString, joy_info, R
{
GetKeyState, joyr, %JoystickNumber%JoyR
axis_info = %axis_info%%a_space%%a_space%R%joyr%
}
IfInString, joy_info, U
{
GetKeyState, joyu, %JoystickNumber%JoyU
axis_info = %axis_info%%a_space%%a_space%U%joyu%
}
IfInString, joy_info, V
{
GetKeyState, joyv, %JoystickNumber%JoyV
axis_info = %axis_info%%a_space%%a_space%V%joyv%
}
IfInString, joy_info, P
{
GetKeyState, joyp, %JoystickNumber%JoyPOV
axis_info = %axis_info%%a_space%%a_space%POV%joyp%
}
ToolTip, %joy_name%:`n%axis_info%`nButtons Down: %buttons_down%`n`n(right-click the tray icon to exit)
Sleep, 100
}
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="KeyboardOnScreen.htm" href="#KeyboardOnScreen.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">On-Screen Keyboard (requires XP/2k/NT) -- by Jon</h3>
<div class="calibre46">
<p class="calibre47"> This script creates a mock keyboard at the bottom of your screen that shows the keys you are pressing in real time. I made it to help me to learn to touch-type (to get used to not looking at the keyboard). The size of the on-screen keyboard can be customized at the top of the script. Also, you can double-click the tray icon to show or hide the keyboard. </p>
<p class="calibre47"><a href="KeyboardOnScreen.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">;---- Configuration Section: Customize the size of the on-screen keyboard and
; other options here.
; Changing this font size will make the entire on-screen keyboard get
; larger or smaller:
k_FontSize = 10
k_FontName = Verdana ; This can be blank to use the system's default font.
k_FontStyle = Bold ; Example of an alternative: Italic Underline
; Names for the tray menu items:
k_MenuItemHide = Hide on-screen &amp;keyboard
k_MenuItemShow = Show on-screen &amp;keyboard
; To have the keyboard appear on a monitor other than the primary, specify
; a number such as 2 for the following variable. Leave it blank to use
; the primary:
k_Monitor =
;---- End of configuration section. Don't change anything below this point
; unless you want to alter the basic nature of the script.
;---- Alter the tray icon menu:
Menu, Tray, Add, %k_MenuItemHide%, k_ShowHide
Menu, Tray, Add, &amp;Exit, k_MenuExit
Menu, Tray, Default, %k_MenuItemHide%
Menu, Tray, NoStandard
;---- Calculate object dimensions based on chosen font size:
k_KeyWidth = %k_FontSize%
k_KeyWidth *= 3
k_KeyHeight = %k_FontSize%
k_KeyHeight *= 3
k_KeyMargin = %k_FontSize%
k_KeyMargin /= 6
k_SpacebarWidth = %k_FontSize%
k_SpacebarWidth *= 25
k_KeyWidthHalf = %k_KeyWidth%
k_KeyWidthHalf /= 2
k_KeySize = w%k_KeyWidth% h%k_KeyHeight%
k_Position = x+%k_KeyMargin% %k_KeySize%
;---- Create a GUI window for the on-screen keyboard:
Gui, Font, s%k_FontSize% %k_FontStyle%, %k_FontName%
Gui, -Caption +E0x200 +ToolWindow
TransColor = F1ECED
Gui, Color, %TransColor% ; This color will be made transparent later below.
;---- Add a button for each key. Position the first button with absolute
; coordinates so that all other buttons can be positioned relative to it:
Gui, Add, Button, section %k_KeySize% xm+%k_KeyWidth%, 1
Gui, Add, Button, %k_Position%, 2
Gui, Add, Button, %k_Position%, 3
Gui, Add, Button, %k_Position%, 4
Gui, Add, Button, %k_Position%, 5
Gui, Add, Button, %k_Position%, 6
Gui, Add, Button, %k_Position%, 7
Gui, Add, Button, %k_Position%, 8
Gui, Add, Button, %k_Position%, 9
Gui, Add, Button, %k_Position%, 0
Gui, Add, Button, %k_Position%, -
Gui, Add, Button, %k_Position%, =
Gui, Add, Button, %k_Position%, Bk
Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, Tab ; Auto-width.
Gui, Add, Button, %k_Position%, Q
Gui, Add, Button, %k_Position%, W
Gui, Add, Button, %k_Position%, E
Gui, Add, Button, %k_Position%, R
Gui, Add, Button, %k_Position%, T
Gui, Add, Button, %k_Position%, Y
Gui, Add, Button, %k_Position%, U
Gui, Add, Button, %k_Position%, I
Gui, Add, Button, %k_Position%, O
Gui, Add, Button, %k_Position%, P
Gui, Add, Button, %k_Position%, [
Gui, Add, Button, %k_Position%, ]
Gui, Add, Button, %k_Position%, \
Gui, Add, Button, xs+%k_KeyWidthHalf% y+%k_KeyMargin% %k_KeySize%, A
Gui, Add, Button, %k_Position%, S
Gui, Add, Button, %k_Position%, D
Gui, Add, Button, %k_Position%, F
Gui, Add, Button, %k_Position%, G
Gui, Add, Button, %k_Position%, H
Gui, Add, Button, %k_Position%, J
Gui, Add, Button, %k_Position%, K
Gui, Add, Button, %k_Position%, L
Gui, Add, Button, %k_Position%, `;
Gui, Add, Button, %k_Position%, '
Gui, Add, Button, x+%k_KeyMargin% h%k_KeyHeight%, Enter ; Auto-width.
; The first button below adds %A_Space% at the end to widen it a little,
; making the layout of keys next to it more accurately reflect a real keyboard:
Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, Shift%A_Space%%A_Space%
Gui, Add, Button, %k_Position%, Z
Gui, Add, Button, %k_Position%, X
Gui, Add, Button, %k_Position%, C
Gui, Add, Button, %k_Position%, V
Gui, Add, Button, %k_Position%, B
Gui, Add, Button, %k_Position%, N
Gui, Add, Button, %k_Position%, M
Gui, Add, Button, %k_Position%, `,
Gui, Add, Button, %k_Position%, .
Gui, Add, Button, %k_Position%, /
Gui, Add, Button, xm y+%k_KeyMargin% h%k_KeyHeight%, Ctrl ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, Win ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin%, Alt ; Auto-width.
Gui, Add, Button, h%k_KeyHeight% x+%k_KeyMargin% w%k_SpacebarWidth%, Space
;---- Show the window:
Gui, Show
k_IsVisible = y
WinGet, k_ID, ID, A ; Get its window ID.
WinGetPos,,, k_WindowWidth, k_WindowHeight, A
;---- Position the keyboard at the bottom of the screen (taking into account
; the position of the taskbar):
SysGet, k_WorkArea, MonitorWorkArea, %k_Monitor%
; Calculate window's X-position:
k_WindowX = %k_WorkAreaRight%
k_WindowX -= %k_WorkAreaLeft% ; Now k_WindowX contains the width of this monitor.
k_WindowX -= %k_WindowWidth%
k_WindowX /= 2 ; Calculate position to center it horizontally.
; The following is done in case the window will be on a non-primary monitor
; or if the taskbar is anchored on the left side of the screen:
k_WindowX += %k_WorkAreaLeft%
; Calculate window's Y-position:
k_WindowY = %k_WorkAreaBottom%
k_WindowY -= %k_WindowHeight%
WinMove, A,, %k_WindowX%, %k_WindowY%
WinSet, AlwaysOnTop, On, ahk_id %k_ID%
WinSet, TransColor, %TransColor% 220, ahk_id %k_ID%
;---- Set all keys as hotkeys. See www.asciitable.com
k_n = 1
k_ASCII = 45
Loop
{
Transform, k_char, Chr, %k_ASCII%
StringUpper, k_char, k_char
if k_char not in &lt;,&gt;,^,~,,`,
Hotkey, ~*%k_char%, k_KeyPress
; In the above, the asterisk prefix allows the key to be detected regardless
; of whether the user is holding down modifier keys such as Control and Shift.
if k_ASCII = 93
break
k_ASCII++
}
return ; End of auto-execute section.
;---- When a key is pressed by the user, click the corresponding button on-screen:
~*Backspace::
ControlClick, Bk, ahk_id %k_ID%, , LEFT, 1, D
KeyWait, Backspace
ControlClick, Bk, ahk_id %k_ID%, , LEFT, 1, U
return
; LShift and RShift are used rather than "Shift" because when used as a hotkey,
; "Shift" would default to firing upon release of the key (in older AHK versions):
~*LShift::
~*RShift::
~*LCtrl:: ; Must use Ctrl not Control to match button names.
~*RCtrl::
~*LAlt::
~*RAlt::
~*LWin::
~*RWin::
StringTrimLeft, k_ThisHotkey, A_ThisHotkey, 3
ControlClick, %k_ThisHotkey%, ahk_id %k_ID%, , LEFT, 1, D
KeyWait, %k_ThisHotkey%
ControlClick, %k_ThisHotkey%, ahk_id %k_ID%, , LEFT, 1, U
return
~*,::
~*'::
~*Space::
~*Enter::
;~*Tab:: ; The TAB key is commented out for now, since it interferes with Alt-Tab.
k_KeyPress:
StringReplace, k_ThisHotkey, A_ThisHotkey, ~
StringReplace, k_ThisHotkey, k_ThisHotkey, *
SetTitleMatchMode, 3 ; Prevents the T and B keys from being confused with Tab and Backspace.
ControlClick, %k_ThisHotkey%, ahk_id %k_ID%, , LEFT, 1, D
KeyWait, %k_ThisHotkey%
ControlClick, %k_ThisHotkey%, ahk_id %k_ID%, , LEFT, 1, U
Return
k_ShowHide:
if k_IsVisible = y
{
Gui, Cancel
Menu, Tray, Rename, %k_MenuItemHide%, %k_MenuItemShow%
k_IsVisible = n
}
else
{
Gui, Show
Menu, Tray, Rename, %k_MenuItemShow%, %k_MenuItemHide%
k_IsVisible = y
}
return
GuiClose:
k_MenuExit:
ExitApp
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Languages.htm" href="#Languages.htm">#</a>
<p class="calibre8">Language values contained in the <a href="#Variables.htm__Language" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">A_Language</a> variable. Note: Values containing letters might use either upper or lower case.</p>
<table border="1" bordercolor="#c0c0c0" cellpadding="3" cellspacing="0" width="100%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre49">Value</td>
<td class="calibre49">Meaning</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0436</td>
<td class="calibre4">Afrikaans</td>
</tr>
<tr class="calibre3">
<td class="calibre4">041c</td>
<td class="calibre4">Albanian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0401</td>
<td class="calibre4">Arabic_Saudi_Arabia</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0801</td>
<td class="calibre4">Arabic_Iraq</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0c01</td>
<td class="calibre4">Arabic_Egypt</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1001</td>
<td class="calibre4">Arabic_Libya</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1401</td>
<td class="calibre4">Arabic_Algeria</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1801</td>
<td class="calibre4">Arabic_Morocco</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1c01</td>
<td class="calibre4">Arabic_Tunisia</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2001</td>
<td class="calibre4">Arabic_Oman</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2401</td>
<td class="calibre4">Arabic_Yemen</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2801</td>
<td class="calibre4">Arabic_Syria</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2c01</td>
<td class="calibre4">Arabic_Jordan</td>
</tr>
<tr class="calibre3">
<td class="calibre4">3001</td>
<td class="calibre4">Arabic_Lebanon</td>
</tr>
<tr class="calibre3">
<td class="calibre4">3401</td>
<td class="calibre4">Arabic_Kuwait</td>
</tr>
<tr class="calibre3">
<td class="calibre4">3801</td>
<td class="calibre4">Arabic_UAE</td>
</tr>
<tr class="calibre3">
<td class="calibre4">3c01</td>
<td class="calibre4">Arabic_Bahrain</td>
</tr>
<tr class="calibre3">
<td class="calibre4">4001</td>
<td class="calibre4">Arabic_Qatar</td>
</tr>
<tr class="calibre3">
<td class="calibre4">042b</td>
<td class="calibre4">Armenian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">042c</td>
<td class="calibre4">Azeri_Latin</td>
</tr>
<tr class="calibre3">
<td class="calibre4">082c</td>
<td class="calibre4">Azeri_Cyrillic</td>
</tr>
<tr class="calibre3">
<td class="calibre4">042d</td>
<td class="calibre4">Basque</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0423</td>
<td class="calibre4">Belarusian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0402</td>
<td class="calibre4">Bulgarian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0403</td>
<td class="calibre4">Catalan</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0404</td>
<td class="calibre4">Chinese_Taiwan</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0804</td>
<td class="calibre4">Chinese_PRC</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0c04</td>
<td class="calibre4">Chinese_Hong_Kong</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1004</td>
<td class="calibre4">Chinese_Singapore</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1404</td>
<td class="calibre4">Chinese_Macau</td>
</tr>
<tr class="calibre3">
<td class="calibre4">041a</td>
<td class="calibre4">Croatian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0405</td>
<td class="calibre4">Czech</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0406</td>
<td class="calibre4">Danish</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0413</td>
<td class="calibre4">Dutch_Standard</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0813</td>
<td class="calibre4">Dutch_Belgian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0409</td>
<td class="calibre4">English_United_States</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0809</td>
<td class="calibre4">English_United_Kingdom</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0c09</td>
<td class="calibre4">English_Australian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1009</td>
<td class="calibre4">English_Canadian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1409</td>
<td class="calibre4">English_New_Zealand</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1809</td>
<td class="calibre4">English_Irish</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1c09</td>
<td class="calibre4">English_South_Africa</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2009</td>
<td class="calibre4">English_Jamaica</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2409</td>
<td class="calibre4">English_Caribbean</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2809</td>
<td class="calibre4">English_Belize</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2c09</td>
<td class="calibre4">English_Trinidad</td>
</tr>
<tr class="calibre3">
<td class="calibre4">3009</td>
<td class="calibre4">English_Zimbabwe</td>
</tr>
<tr class="calibre3">
<td class="calibre4">3409</td>
<td class="calibre4">English_Philippines</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0425</td>
<td class="calibre4">Estonian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0438</td>
<td class="calibre4">Faeroese</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0429</td>
<td class="calibre4">Farsi</td>
</tr>
<tr class="calibre3">
<td class="calibre4">040b</td>
<td class="calibre4">Finnish</td>
</tr>
<tr class="calibre3">
<td class="calibre4">040c</td>
<td class="calibre4">French_Standard</td>
</tr>
<tr class="calibre3">
<td class="calibre4">080c</td>
<td class="calibre4">French_Belgian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0c0c</td>
<td class="calibre4">French_Canadian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">100c</td>
<td class="calibre4">French_Swiss</td>
</tr>
<tr class="calibre3">
<td class="calibre4">140c</td>
<td class="calibre4">French_Luxembourg</td>
</tr>
<tr class="calibre3">
<td class="calibre4">180c</td>
<td class="calibre4">French_Monaco</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0437</td>
<td class="calibre4">Georgian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0407</td>
<td class="calibre4">German_Standard</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0807</td>
<td class="calibre4">German_Swiss</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0c07</td>
<td class="calibre4">German_Austrian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1007</td>
<td class="calibre4">German_Luxembourg</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1407</td>
<td class="calibre4">German_Liechtenstei</td>
</tr>
<tr class="calibre3">
<td class="calibre4">408</td>
<td class="calibre4">Greek</td>
</tr>
<tr class="calibre3">
<td class="calibre4">040d</td>
<td class="calibre4">Hebrew</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0439</td>
<td class="calibre4">Hindi</td>
</tr>
<tr class="calibre3">
<td class="calibre4">040e</td>
<td class="calibre4">Hungarian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">040f</td>
<td class="calibre4">Icelandic</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0421</td>
<td class="calibre4">Indonesian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0410</td>
<td class="calibre4">Italian_Standard</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0810</td>
<td class="calibre4">Italian_Swiss</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0411</td>
<td class="calibre4">Japanese</td>
</tr>
<tr class="calibre3">
<td class="calibre4">043f</td>
<td class="calibre4">Kazakh</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0457</td>
<td class="calibre4">Konkani</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0412</td>
<td class="calibre4">Korean</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0426</td>
<td class="calibre4">Latvian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0427</td>
<td class="calibre4">Lithuanian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">042f</td>
<td class="calibre4">Macedonian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">043e</td>
<td class="calibre4">Malay_Malaysia</td>
</tr>
<tr class="calibre3">
<td class="calibre4">083e</td>
<td class="calibre4">Malay_Brunei_Darussalam</td>
</tr>
<tr class="calibre3">
<td class="calibre4">044e</td>
<td class="calibre4">Marathi</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0414</td>
<td class="calibre4">Norwegian_Bokmal</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0814</td>
<td class="calibre4">Norwegian_Nynorsk</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0415</td>
<td class="calibre4">Polish</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0416</td>
<td class="calibre4">Portuguese_Brazilian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0816</td>
<td class="calibre4">Portuguese_Standard</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0418</td>
<td class="calibre4">Romanian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0419</td>
<td class="calibre4">Russian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">044f</td>
<td class="calibre4">Sanskrit</td>
</tr>
<tr class="calibre3">
<td class="calibre4">081a</td>
<td class="calibre4">Serbian_Latin</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0c1a</td>
<td class="calibre4">Serbian_Cyrillic</td>
</tr>
<tr class="calibre3">
<td class="calibre4">041b</td>
<td class="calibre4">Slovak</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0424</td>
<td class="calibre4">Slovenian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">040a</td>
<td class="calibre4">Spanish_Traditional_Sort</td>
</tr>
<tr class="calibre3">
<td class="calibre4">080a</td>
<td class="calibre4">Spanish_Mexican</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0c0a</td>
<td class="calibre4">Spanish_Modern_Sort</td>
</tr>
<tr class="calibre3">
<td class="calibre4">100a</td>
<td class="calibre4">Spanish_Guatemala</td>
</tr>
<tr class="calibre3">
<td class="calibre4">140a</td>
<td class="calibre4">Spanish_Costa_Rica</td>
</tr>
<tr class="calibre3">
<td class="calibre4">180a</td>
<td class="calibre4">Spanish_Panama</td>
</tr>
<tr class="calibre3">
<td class="calibre4">1c0a</td>
<td class="calibre4">Spanish_Dominican_Republic</td>
</tr>
<tr class="calibre3">
<td class="calibre4">200a</td>
<td class="calibre4">Spanish_Venezuela</td>
</tr>
<tr class="calibre3">
<td class="calibre4">240a</td>
<td class="calibre4">Spanish_Colombia</td>
</tr>
<tr class="calibre3">
<td class="calibre4">280a</td>
<td class="calibre4">Spanish_Peru</td>
</tr>
<tr class="calibre3">
<td class="calibre4">2c0a</td>
<td class="calibre4">Spanish_Argentina</td>
</tr>
<tr class="calibre3">
<td class="calibre4">300a</td>
<td class="calibre4">Spanish_Ecuador</td>
</tr>
<tr class="calibre3">
<td class="calibre4">340a</td>
<td class="calibre4">Spanish_Chile</td>
</tr>
<tr class="calibre3">
<td class="calibre4">380a</td>
<td class="calibre4">Spanish_Uruguay</td>
</tr>
<tr class="calibre3">
<td class="calibre4">3c0a</td>
<td class="calibre4">Spanish_Paraguay</td>
</tr>
<tr class="calibre3">
<td class="calibre4">400a</td>
<td class="calibre4">Spanish_Bolivia</td>
</tr>
<tr class="calibre3">
<td class="calibre4">440a</td>
<td class="calibre4">Spanish_El_Salvador</td>
</tr>
<tr class="calibre3">
<td class="calibre4">480a</td>
<td class="calibre4">Spanish_Honduras</td>
</tr>
<tr class="calibre3">
<td class="calibre4">4c0a</td>
<td class="calibre4">Spanish_Nicaragua</td>
</tr>
<tr class="calibre3">
<td class="calibre4">500a</td>
<td class="calibre4">Spanish_Puerto_Rico</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0441</td>
<td class="calibre4">Swahili</td>
</tr>
<tr class="calibre3">
<td class="calibre4">041d</td>
<td class="calibre4">Swedish</td>
</tr>
<tr class="calibre3">
<td class="calibre4">081d</td>
<td class="calibre4">Swedish_Finland</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0449</td>
<td class="calibre4">Tamil</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0444</td>
<td class="calibre4">Tatar</td>
</tr>
<tr class="calibre3">
<td class="calibre4">041e</td>
<td class="calibre4">Thai</td>
</tr>
<tr class="calibre3">
<td class="calibre4">041f</td>
<td class="calibre4">Turkish</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0422</td>
<td class="calibre4">Ukrainian</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0420</td>
<td class="calibre4">Urdu</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0443</td>
<td class="calibre4">Uzbek_Latin</td>
</tr>
<tr class="calibre3">
<td class="calibre4">0843</td>
<td class="calibre4">Uzbek_Cyrillic</td>
</tr>
<tr class="calibre3">
<td class="calibre4">042a</td>
<td class="calibre4">Vietnamese</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="MinimizeToTrayMenu.htm" href="#MinimizeToTrayMenu.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Minimize Window to Tray Menu</h3>
<div class="calibre46">
<p class="calibre47"> This script assigns a hotkey of your choice to hide any window so that it becomes an entry at the bottom of the script's tray menu. Hidden windows can then be restored individually or all at once by selecting the corresponding item on the menu. If the script exits for any reason, all the windows that it hid will be restored automatically. </p>
<p class="calibre47"><a href="MinimizeToTrayMenu.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">; CHANGES:
; November 3, 2004 (changes provided by trogdor):
; - Program manager is prevented from being hidden.
; - If there is no active window, the minimize-to-tray hotkey will have
; no effect rather than waiting indefinitely.
;
; October 23, 2004:
; - The taskbar is prevented from being hidden.
; - Some possible problems with long window titles have been fixed.
; - Windows without a title can be hidden without causing problems.
; - If the script is running under AHK v1.0.22 or greater, the
; maximum length of each menu item is increased from 100 to 260.
; CONFIGURATION SECTION: Change the below values as desired.
; This is the maximum number of windows to allow to be hidden (having a
; limit helps performance):
mwt_MaxWindows = 50
; This is the hotkey used to hide the active window:
mwt_Hotkey = #h ; Win+H
; If you prefer to have the tray menu empty of all the standard items,
; such as Help and Pause, use N. Otherwise, use Y:
mwt_StandardMenu = N
; These next few performance settings help to keep the action within the
; #HotkeyModifierTimeout period, and thus avoid the need to release and
; press down the hotkey's modifier if you want to hide more than one
; window in a row. These settings are not needed you choose to have the
; script use the keyboard hook via #InstallKeybdHook or other means:
#HotkeyModifierTimeout 100
SetWinDelay 10
SetKeyDelay 0
#SingleInstance ; Allow only one instance of this script to be running.
; END OF CONFIGURATION SECTION (do not make changes below this point
; unless you want to change the basic functionality of the script).
Hotkey, %mwt_Hotkey%, mwt_Minimize
; If the user terminates the script by any means, unhide all the
; windows first:
OnExit, mwt_RestoreAllThenExit
if mwt_StandardMenu = Y
Menu, Tray, Add
else
{
Menu, Tray, NoStandard
Menu, Tray, Add, E&amp;xit and Restore All, mwt_RestoreAllThenExit
}
Menu, Tray, Add, &amp;Restore All Hidden Windows, mwt_RestoreAll
Menu, Tray, Add ; Another separator line to make the above more special.
if a_AhkVersion = ; Since it's blank, version is older than 1.0.22.
mwt_MaxLength = 100
else
mwt_MaxLength = 260 ; Reduce this to restrict the width of the menu.
return ; End of auto-execute section.
mwt_Minimize:
if mwt_WindowCount &gt;= %mwt_MaxWindows%
{
MsgBox No more than %mwt_MaxWindows% may be hidden simultaneously.
return
}
; Set the "last found window" to simplify and help performance.
; Since in certain cases it is possible for there to be no active window,
; a timeout has been added:
WinWait, A,, 2
if ErrorLevel &lt;&gt; 0 ; It timed out, so do nothing.
return
; Otherwise, the "last found window" has been set and can now be used:
WinGet, mwt_ActiveID, ID
WinGetTitle, mwt_ActiveTitle
WinGetClass, mwt_ActiveClass
if mwt_ActiveClass in Shell_TrayWnd,Progman
{
MsgBox The desktop and taskbar cannot be hidden.
return
}
; Because hiding the window won't deactivate it, activate the window
; beneath this one (if any). I tried other ways, but they wound up
; activating the task bar. This way sends the active window (which is
; about to be hidden) to the back of the stack, which seems best:
Send, !{esc}
; Hide it only now that WinGetTitle/WinGetClass above have been run (since
; by default, those commands cannot detect hidden windows):
WinHide
; If the title is blank, use the class instead. This serves two purposes:
; 1) A more meaningful name is used as the menu name.
; 2) Allows the menu item to be created (otherwise, blank items wouldn't
; be handled correctly by the various routines below).
if mwt_ActiveTitle =
mwt_ActiveTitle = ahk_class %mwt_ActiveClass%
; Ensure the title is short enough to fit. mwt_ActiveTitle also serves to
; uniquely identify this particular menu item.
StringLeft, mwt_ActiveTitle, mwt_ActiveTitle, %mwt_MaxLength%
; In addition to the tray menu requiring that each menu item name be
; unique, it must also be unique so that we can reliably look it up in
; the array when the window is later unhidden. So make it unique if it
; isn't already:
Loop, %mwt_MaxWindows%
{
if mwt_WindowTitle%a_index% = %mwt_ActiveTitle%
{
; Match found, so it's not unique.
; First remove the 0x from the hex number to conserve menu space:
StringTrimLeft, mwt_ActiveIDShort, mwt_ActiveID, 2
StringLen, mwt_ActiveIDShortLength, mwt_ActiveIDShort
StringLen, mwt_ActiveTitleLength, mwt_ActiveTitle
mwt_ActiveTitleLength += %mwt_ActiveIDShortLength%
mwt_ActiveTitleLength += 1 ; +1 the 1 space between title &amp; ID.
if mwt_ActiveTitleLength &gt; %mwt_MaxLength%
{
; Since menu item names are limted in length, trim the title
; down to allow just enough room for the Window's Short ID at
; the end of its name:
TrimCount = %mwt_ActiveTitleLength%
TrimCount -= %mwt_MaxLength%
StringTrimRight, mwt_ActiveTitle, mwt_ActiveTitle, %TrimCount%
}
; Build unique title:
mwt_ActiveTitle = %mwt_ActiveTitle% %mwt_ActiveIDShort%
break
}
}
; First, ensure that this ID doesn't already exist in the list, which can
; happen if a particular window was externally unhidden (or its app unhid
; it) and now it's about to be re-hidden:
mwt_AlreadyExists = n
Loop, %mwt_MaxWindows%
{
if mwt_WindowID%a_index% = %mwt_ActiveID%
{
mwt_AlreadyExists = y
break
}
}
; Add the item to the array and to the menu:
if mwt_AlreadyExists = n
{
Menu, Tray, add, %mwt_ActiveTitle%, RestoreFromTrayMenu
mwt_WindowCount += 1
Loop, %mwt_MaxWindows% ; Search for a free slot.
{
; It should always find a free slot if things are designed right.
if mwt_WindowID%a_index% = ; An empty slot was found.
{
mwt_WindowID%a_index% = %mwt_ActiveID%
mwt_WindowTitle%a_index% = %mwt_ActiveTitle%
break
}
}
}
return
RestoreFromTrayMenu:
Menu, Tray, delete, %A_ThisMenuItem%
; Find window based on its unique title stored as the menu item name:
Loop, %mwt_MaxWindows%
{
if mwt_WindowTitle%a_index% = %A_ThisMenuItem% ; Match found.
{
StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0
WinShow, ahk_id %IDToRestore%
WinActivate ahk_id %IDToRestore% ; Sometimes needed.
mwt_WindowID%a_index% = ; Make it blank to free up a slot.
mwt_WindowTitle%a_index% =
mwt_WindowCount -= 1
break
}
}
return
mwt_RestoreAllThenExit:
Gosub, mwt_RestoreAll
ExitApp ; Do a true exit.
mwt_RestoreAll:
Loop, %mwt_MaxWindows%
{
if mwt_WindowID%a_index% &lt;&gt;
{
StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0
WinShow, ahk_id %IDToRestore%
WinActivate ahk_id %IDToRestore% ; Sometimes needed.
; Do it this way vs. DeleteAll so that the sep. line and first
; item are retained:
StringTrimRight, MenuToRemove, mwt_WindowTitle%a_index%, 0
Menu, Tray, delete, %MenuToRemove%
mwt_WindowID%a_index% = ; Make it blank to free up a slot.
mwt_WindowTitle%a_index% =
mwt_WindowCount -= 1
}
if mwt_WindowCount = 0
break
}
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="MsgBoxButtonNames.htm" href="#MsgBoxButtonNames.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Changing MsgBox's Button Names</h3>
<div class="calibre46">
<p class="calibre47"> This is a working example script that uses a timer to change the names of the buttons in a MsgBox dialog. Although the button names are changed, the IfMsgBox command still requires that the buttons be referred to by their original names. </p>
<p class="calibre47"><a href="MsgBoxButtonNames.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">#SingleInstance
SetTimer, ChangeButtonNames, 50
MsgBox, 4, Add or Delete, Choose a button:
IfMsgBox, YES
MsgBox, You chose Add.
else
MsgBox, You chose Delete.
return
ChangeButtonNames:
IfWinNotExist, Add or Delete, , return ; Keep waiting.
SetTimer, ChangeButtonNames, off
WinActivate
ControlSetText, &amp;Yes, &amp;Add
ControlSetText, &amp;No, &amp;Delete
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Numpad000.htm" href="#Numpad000.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Numpad 000 Key</h3>
<div class="calibre46">
<p class="calibre47"> This example script makes the special 000 key that appears on certain keypads into an equals key. You can change the action by replacing the “Send, =” line with line(s) of your choice. </p>
<p class="calibre47"><a href="Numpad000.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">#MaxThreadsPerHotkey 5 ; Allow multiple threads for this hotkey.
$Numpad0::
#MaxThreadsPerHotkey 1
; Above: Use the $ to force the hook to be used, which prevents an
; infinite loop since this subroutine itself sends Numpad0, which
; would otherwise result in a recursive call to itself.
SetBatchLines, 100 ; Make it run a little faster in this case.
DelayBetweenKeys = 30 ; Adjust this value if it doesn't work.
if A_PriorHotkey = %A_ThisHotkey%
{
if A_TimeSincePriorHotkey &lt; %DelayBetweenKeys%
{
if Numpad0Count =
Numpad0Count = 2 ; i.e. This one plus the prior one.
else if Numpad0Count = 0
Numpad0Count = 2
else
{
; Since we're here, Numpad0Count must be 2 as set by
; prior calls, which means this is the third time the
; the key has been pressed. Thus, the hotkey sequence
; should fire:
Numpad0Count = 0
Send, = ; ******* This is the action for the 000 key
}
; In all the above cases, we return without further action:
CalledReentrantly = y
return
}
}
; Otherwise, this Numpad0 event is either the first in the series
; or it happened too long after the first one (e.g. perhaps the
; user is holding down the Numpad0 key to auto-repeat it, which
; we want to allow). Therefore, after a short delay -- during
; which another Numpad0 hotkey event may re-entrantly call this
; subroutine -- we'll send the key on through if no reentrant
; calls occurred:
Numpad0Count = 0
CalledReentrantly = n
; During this sleep, this subroutine may be reentrantly called
; (i.e. a simultaneous "thread" which runs in parallel to the
; call we're in now):
Sleep, %DelayBetweenKeys%
if CalledReentrantly = y ; Another "thread" changed the value.
{
; Since it was called reentrantly, this key event was the first in
; the sequence so should be suppressed (hidden from the system):
CalledReentrantly = n
return
}
; Otherwise it's not part of the sequence so we send it through normally.
; In other words, the *real* Numpad0 key has been pressed, so we want it
; to have its normal effect:
Send, {Numpad0}
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="NumpadMouse.htm" href="#NumpadMouse.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Using Keyboard Numpad as a Mouse -- by deguix</h3>
<div class="calibre46">
<p class="calibre47"> This script makes mousing with your keyboard almost as easy as using a real mouse (maybe even easier for some tasks). It supports up to five mouse buttons and the turning of the mouse wheel. It also features customizable movement speed, acceleration, and "axis inversion". </p>
<p class="calibre47"><a href="NumpadMouse.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">/*
o------------------------------------------------------------o
|Using Keyboard Numpad as a Mouse |
(------------------------------------------------------------)
| By deguix / A Script file for AutoHotkey 1.0.22+ |
| ----------------------------------------|
| |
| This script is an example of use of AutoHotkey. It uses |
| the remapping of numpad keys of a keyboard to transform it |
| into a mouse. Some features are the acceleration which |
| enables you to increase the mouse movement when holding |
| a key for a long time, and the rotation which makes the |
| numpad mouse to "turn". I.e. NumPadDown as NumPadUp |
| and vice-versa. See the list of keys used below: |
| |
|------------------------------------------------------------|
| Keys | Description |
|------------------------------------------------------------|
| ScrollLock (toggle on)| Activates numpad mouse mode. |
|-----------------------|------------------------------------|
| NumPad0 | Left mouse button click. |
| NumPad5 | Middle mouse button click. |
| NumPadDot | Right mouse button click. |
| NumPadDiv/NumPadMult | X1/X2 mouse button click. (Win 2k+)|
| NumPadSub/NumPadAdd | Moves up/down the mouse wheel. |
| | |
|-----------------------|------------------------------------|
| NumLock (toggled off) | Activates mouse movement mode. |
|-----------------------|------------------------------------|
| NumPadEnd/Down/PgDn/ | Mouse movement. |
| /Left/Right/Home/Up/ | |
| /PgUp | |
| | |
|-----------------------|------------------------------------|
| NumLock (toggled on) | Activates mouse speed adj. mode. |
|-----------------------|------------------------------------|
| NumPad7/NumPad1 | Inc./dec. acceleration per |
| | button press. |
| NumPad8/NumPad2 | Inc./dec. initial speed per |
| | button press. |
| NumPad9/NumPad3 | Inc./dec. maximum speed per |
| | button press. |
| ^NumPad7/^NumPad1 | Inc./dec. wheel acceleration per |
| | button press*. |
| ^NumPad8/^NumPad2 | Inc./dec. wheel initial speed per |
| | button press*. |
| ^NumPad9/^NumPad3 | Inc./dec. wheel maximum speed per |
| | button press*. |
| NumPad4/NumPad6 | Inc./dec. rotation angle to |
| | right in degrees. (i.e. 180° = |
| | = inversed controls). |
|------------------------------------------------------------|
| * = These options are affected by the mouse wheel speed |
| adjusted on Control Panel. If you don't have a mouse with |
| wheel, the default is 3 +/- lines per option button press. |
o------------------------------------------------------------o
*/
;START OF CONFIG SECTION
#SingleInstance force
#MaxHotkeysPerInterval 500
; Using the keyboard hook to implement the Numpad hotkeys prevents
; them from interfering with the generation of ANSI characters such
; as à. This is because AutoHotkey generates such characters
; by holding down ALT and sending a series of Numpad keystrokes.
; Hook hotkeys are smart enough to ignore such keystrokes.
#UseHook
MouseSpeed = 1
MouseAccelerationSpeed = 1
MouseMaxSpeed = 5
;Mouse wheel speed is also set on Control Panel. As that
;will affect the normal mouse behavior, the real speed of
;these three below are times the normal mouse wheel speed.
MouseWheelSpeed = 1
MouseWheelAccelerationSpeed = 1
MouseWheelMaxSpeed = 5
MouseRotationAngle = 0
;END OF CONFIG SECTION
;This is needed or key presses would faulty send their natural
;actions. Like NumPadDiv would send sometimes "/" to the
;screen.
#InstallKeybdHook
Temp = 0
Temp2 = 0
MouseRotationAnglePart = %MouseRotationAngle%
;Divide by 45º because MouseMove only supports whole numbers,
;and changing the mouse rotation to a number lesser than 45º
;could make strange movements.
;
;For example: 22.5º when pressing NumPadUp:
; First it would move upwards until the speed
; to the side reaches 1.
MouseRotationAnglePart /= 45
MouseCurrentAccelerationSpeed = 0
MouseCurrentSpeed = %MouseSpeed%
MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseSpeed%
SetKeyDelay, -1
SetMouseDelay, -1
Hotkey, *NumPad0, ButtonLeftClick
Hotkey, *NumpadIns, ButtonLeftClickIns
Hotkey, *NumPad5, ButtonMiddleClick
Hotkey, *NumpadClear, ButtonMiddleClickClear
Hotkey, *NumPadDot, ButtonRightClick
Hotkey, *NumPadDel, ButtonRightClickDel
Hotkey, *NumPadDiv, ButtonX1Click
Hotkey, *NumPadMult, ButtonX2Click
Hotkey, *NumpadSub, ButtonWheelUp
Hotkey, *NumpadAdd, ButtonWheelDown
Hotkey, *NumPadUp, ButtonUp
Hotkey, *NumPadDown, ButtonDown
Hotkey, *NumPadLeft, ButtonLeft
Hotkey, *NumPadRight, ButtonRight
Hotkey, *NumPadHome, ButtonUpLeft
Hotkey, *NumPadEnd, ButtonUpRight
Hotkey, *NumPadPgUp, ButtonDownLeft
Hotkey, *NumPadPgDn, ButtonDownRight
Hotkey, Numpad8, ButtonSpeedUp
Hotkey, Numpad2, ButtonSpeedDown
Hotkey, Numpad7, ButtonAccelerationSpeedUp
Hotkey, Numpad1, ButtonAccelerationSpeedDown
Hotkey, Numpad9, ButtonMaxSpeedUp
Hotkey, Numpad3, ButtonMaxSpeedDown
Hotkey, Numpad6, ButtonRotationAngleUp
Hotkey, Numpad4, ButtonRotationAngleDown
Hotkey, !Numpad8, ButtonWheelSpeedUp
Hotkey, !Numpad2, ButtonWheelSpeedDown
Hotkey, !Numpad7, ButtonWheelAccelerationSpeedUp
Hotkey, !Numpad1, ButtonWheelAccelerationSpeedDown
Hotkey, !Numpad9, ButtonWheelMaxSpeedUp
Hotkey, !Numpad3, ButtonWheelMaxSpeedDown
Gosub, ~ScrollLock ; Initialize based on current ScrollLock state.
return
;Key activation support
~ScrollLock::
; Wait for it to be released because otherwise the hook state gets reset
; while the key is down, which causes the up-event to get suppressed,
; which in turn prevents toggling of the ScrollLock state/light:
KeyWait, ScrollLock
GetKeyState, ScrollLockState, ScrollLock, T
If ScrollLockState = D
{
Hotkey, *NumPad0, on
Hotkey, *NumpadIns, on
Hotkey, *NumPad5, on
Hotkey, *NumPadDot, on
Hotkey, *NumPadDel, on
Hotkey, *NumPadDiv, on
Hotkey, *NumPadMult, on
Hotkey, *NumpadSub, on
Hotkey, *NumpadAdd, on
Hotkey, *NumPadUp, on
Hotkey, *NumPadDown, on
Hotkey, *NumPadLeft, on
Hotkey, *NumPadRight, on
Hotkey, *NumPadHome, on
Hotkey, *NumPadEnd, on
Hotkey, *NumPadPgUp, on
Hotkey, *NumPadPgDn, on
Hotkey, Numpad8, on
Hotkey, Numpad2, on
Hotkey, Numpad7, on
Hotkey, Numpad1, on
Hotkey, Numpad9, on
Hotkey, Numpad3, on
Hotkey, Numpad6, on
Hotkey, Numpad4, on
Hotkey, !Numpad8, on
Hotkey, !Numpad2, on
Hotkey, !Numpad7, on
Hotkey, !Numpad1, on
Hotkey, !Numpad9, on
Hotkey, !Numpad3, on
}
else
{
Hotkey, *NumPad0, off
Hotkey, *NumpadIns, off
Hotkey, *NumPad5, off
Hotkey, *NumPadDot, off
Hotkey, *NumPadDel, off
Hotkey, *NumPadDiv, off
Hotkey, *NumPadMult, off
Hotkey, *NumpadSub, off
Hotkey, *NumpadAdd, off
Hotkey, *NumPadUp, off
Hotkey, *NumPadDown, off
Hotkey, *NumPadLeft, off
Hotkey, *NumPadRight, off
Hotkey, *NumPadHome, off
Hotkey, *NumPadEnd, off
Hotkey, *NumPadPgUp, off
Hotkey, *NumPadPgDn, off
Hotkey, Numpad8, off
Hotkey, Numpad2, off
Hotkey, Numpad7, off
Hotkey, Numpad1, off
Hotkey, Numpad9, off
Hotkey, Numpad3, off
Hotkey, Numpad6, off
Hotkey, Numpad4, off
Hotkey, !Numpad8, off
Hotkey, !Numpad2, off
Hotkey, !Numpad7, off
Hotkey, !Numpad1, off
Hotkey, !Numpad9, off
Hotkey, !Numpad3, off
}
return
;Mouse click support
ButtonLeftClick:
GetKeyState, already_down_state, LButton
If already_down_state = D
return
Button2 = NumPad0
ButtonClick = Left
Goto ButtonClickStart
ButtonLeftClickIns:
GetKeyState, already_down_state, LButton
If already_down_state = D
return
Button2 = NumPadIns
ButtonClick = Left
Goto ButtonClickStart
ButtonMiddleClick:
GetKeyState, already_down_state, MButton
If already_down_state = D
return
Button2 = NumPad5
ButtonClick = Middle
Goto ButtonClickStart
ButtonMiddleClickClear:
GetKeyState, already_down_state, MButton
If already_down_state = D
return
Button2 = NumPadClear
ButtonClick = Middle
Goto ButtonClickStart
ButtonRightClick:
GetKeyState, already_down_state, RButton
If already_down_state = D
return
Button2 = NumPadDot
ButtonClick = Right
Goto ButtonClickStart
ButtonRightClickDel:
GetKeyState, already_down_state, RButton
If already_down_state = D
return
Button2 = NumPadDel
ButtonClick = Right
Goto ButtonClickStart
ButtonX1Click:
GetKeyState, already_down_state, XButton1
If already_down_state = D
return
Button2 = NumPadDiv
ButtonClick = X1
Goto ButtonClickStart
ButtonX2Click:
GetKeyState, already_down_state, XButton2
If already_down_state = D
return
Button2 = NumPadMult
ButtonClick = X2
Goto ButtonClickStart
ButtonClickStart:
MouseClick, %ButtonClick%,,, 1, 0, D
SetTimer, ButtonClickEnd, 10
return
ButtonClickEnd:
GetKeyState, kclickstate, %Button2%, P
if kclickstate = D
return
SetTimer, ButtonClickEnd, off
MouseClick, %ButtonClick%,,, 1, 0, U
return
;Mouse movement support
ButtonSpeedUp:
MouseSpeed++
ToolTip, Mouse speed: %MouseSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonSpeedDown:
If MouseSpeed &gt; 1
MouseSpeed--
If MouseSpeed = 1
ToolTip, Mouse speed: %MouseSpeed% pixel
else
ToolTip, Mouse speed: %MouseSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonAccelerationSpeedUp:
MouseAccelerationSpeed++
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonAccelerationSpeedDown:
If MouseAccelerationSpeed &gt; 1
MouseAccelerationSpeed--
If MouseAccelerationSpeed = 1
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixel
else
ToolTip, Mouse acceleration speed: %MouseAccelerationSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonMaxSpeedUp:
MouseMaxSpeed++
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonMaxSpeedDown:
If MouseMaxSpeed &gt; 1
MouseMaxSpeed--
If MouseMaxSpeed = 1
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixel
else
ToolTip, Mouse maximum speed: %MouseMaxSpeed% pixels
SetTimer, RemoveToolTip, 1000
return
ButtonRotationAngleUp:
MouseRotationAnglePart++
If MouseRotationAnglePart &gt;= 8
MouseRotationAnglePart = 0
MouseRotationAngle = %MouseRotationAnglePart%
MouseRotationAngle *= 45
ToolTip, Mouse rotation angle: %MouseRotationAngle%°
SetTimer, RemoveToolTip, 1000
return
ButtonRotationAngleDown:
MouseRotationAnglePart--
If MouseRotationAnglePart &lt; 0
MouseRotationAnglePart = 7
MouseRotationAngle = %MouseRotationAnglePart%
MouseRotationAngle *= 45
ToolTip, Mouse rotation angle: %MouseRotationAngle%°
SetTimer, RemoveToolTip, 1000
return
ButtonUp:
ButtonDown:
ButtonLeft:
ButtonRight:
ButtonUpLeft:
ButtonUpRight:
ButtonDownLeft:
ButtonDownRight:
If Button &lt;&gt; 0
{
IfNotInString, A_ThisHotkey, %Button%
{
MouseCurrentAccelerationSpeed = 0
MouseCurrentSpeed = %MouseSpeed%
}
}
StringReplace, Button, A_ThisHotkey, *
ButtonAccelerationStart:
If MouseAccelerationSpeed &gt;= 1
{
If MouseMaxSpeed &gt; %MouseCurrentSpeed%
{
Temp = 0.001
Temp *= %MouseAccelerationSpeed%
MouseCurrentAccelerationSpeed += %Temp%
MouseCurrentSpeed += %MouseCurrentAccelerationSpeed%
}
}
;MouseRotationAngle convertion to speed of button direction
{
MouseCurrentSpeedToDirection = %MouseRotationAngle%
MouseCurrentSpeedToDirection /= 90.0
Temp = %MouseCurrentSpeedToDirection%
if Temp &gt;= 0
{
if Temp &lt; 1
{
MouseCurrentSpeedToDirection = 1
MouseCurrentSpeedToDirection -= %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
if Temp &gt;= 1
{
if Temp &lt; 2
{
MouseCurrentSpeedToDirection = 0
Temp -= 1
MouseCurrentSpeedToDirection -= %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
if Temp &gt;= 2
{
if Temp &lt; 3
{
MouseCurrentSpeedToDirection = -1
Temp -= 2
MouseCurrentSpeedToDirection += %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
if Temp &gt;= 3
{
if Temp &lt; 4
{
MouseCurrentSpeedToDirection = 0
Temp -= 3
MouseCurrentSpeedToDirection += %Temp%
Goto EndMouseCurrentSpeedToDirectionCalculation
}
}
}
EndMouseCurrentSpeedToDirectionCalculation:
;MouseRotationAngle convertion to speed of 90 degrees to right
{
MouseCurrentSpeedToSide = %MouseRotationAngle%
MouseCurrentSpeedToSide /= 90.0
Temp = %MouseCurrentSpeedToSide%
Transform, Temp, mod, %Temp%, 4
if Temp &gt;= 0
{
if Temp &lt; 1
{
MouseCurrentSpeedToSide = 0
MouseCurrentSpeedToSide += %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
if Temp &gt;= 1
{
if Temp &lt; 2
{
MouseCurrentSpeedToSide = 1
Temp -= 1
MouseCurrentSpeedToSide -= %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
if Temp &gt;= 2
{
if Temp &lt; 3
{
MouseCurrentSpeedToSide = 0
Temp -= 2
MouseCurrentSpeedToSide -= %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
if Temp &gt;= 3
{
if Temp &lt; 4
{
MouseCurrentSpeedToSide = -1
Temp -= 3
MouseCurrentSpeedToSide += %Temp%
Goto EndMouseCurrentSpeedToSideCalculation
}
}
}
EndMouseCurrentSpeedToSideCalculation:
MouseCurrentSpeedToDirection *= %MouseCurrentSpeed%
MouseCurrentSpeedToSide *= %MouseCurrentSpeed%
Temp = %MouseRotationAnglePart%
Transform, Temp, Mod, %Temp%, 2
If Button = NumPadUp
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseCurrentSpeedToDirection *= -1
MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R
}
else if Button = NumPadDown
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseCurrentSpeedToSide *= -1
MouseMove, %MouseCurrentSpeedToSide%, %MouseCurrentSpeedToDirection%, 0, R
}
else if Button = NumPadLeft
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseCurrentSpeedToSide *= -1
MouseCurrentSpeedToDirection *= -1
MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R
}
else if Button = NumPadRight
{
if Temp = 1
{
MouseCurrentSpeedToSide *= 2
MouseCurrentSpeedToDirection *= 2
}
MouseMove, %MouseCurrentSpeedToDirection%, %MouseCurrentSpeedToSide%, 0, R
}
else if Button = NumPadHome
{
Temp = %MouseCurrentSpeedToDirection%
Temp -= %MouseCurrentSpeedToSide%
Temp *= -1
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 += %MouseCurrentSpeedToSide%
Temp2 *= -1
MouseMove, %Temp%, %Temp2%, 0, R
}
else if Button = NumPadPgUp
{
Temp = %MouseCurrentSpeedToDirection%
Temp += %MouseCurrentSpeedToSide%
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 -= %MouseCurrentSpeedToSide%
Temp2 *= -1
MouseMove, %Temp%, %Temp2%, 0, R
}
else if Button = NumPadEnd
{
Temp = %MouseCurrentSpeedToDirection%
Temp += %MouseCurrentSpeedToSide%
Temp *= -1
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 -= %MouseCurrentSpeedToSide%
MouseMove, %Temp%, %Temp2%, 0, R
}
else if Button = NumPadPgDn
{
Temp = %MouseCurrentSpeedToDirection%
Temp -= %MouseCurrentSpeedToSide%
Temp2 *= -1
Temp2 = %MouseCurrentSpeedToDirection%
Temp2 += %MouseCurrentSpeedToSide%
MouseMove, %Temp%, %Temp2%, 0, R
}
SetTimer, ButtonAccelerationEnd, 10
return
ButtonAccelerationEnd:
GetKeyState, kstate, %Button%, P
if kstate = D
Goto ButtonAccelerationStart
SetTimer, ButtonAccelerationEnd, off
MouseCurrentAccelerationSpeed = 0
MouseCurrentSpeed = %MouseSpeed%
Button = 0
return
;Mouse wheel movement support
ButtonWheelSpeedUp:
MouseWheelSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier &lt;= 0
MouseWheelSpeedMultiplier = 1
MouseWheelSpeedReal = %MouseWheelSpeed%
MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier &lt;= 0
MouseWheelSpeedMultiplier = 1
If MouseWheelSpeedReal &gt; %MouseWheelSpeedMultiplier%
{
MouseWheelSpeed--
MouseWheelSpeedReal = %MouseWheelSpeed%
MouseWheelSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelSpeedReal = 1
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% line
else
ToolTip, Mouse wheel speed: %MouseWheelSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelAccelerationSpeedUp:
MouseWheelAccelerationSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier &lt;= 0
MouseWheelSpeedMultiplier = 1
MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelAccelerationSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier &lt;= 0
MouseWheelSpeedMultiplier = 1
If MouseWheelAccelerationSpeed &gt; 1
{
MouseWheelAccelerationSpeed--
MouseWheelAccelerationSpeedReal = %MouseWheelAccelerationSpeed%
MouseWheelAccelerationSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelAccelerationSpeedReal = 1
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% line
else
ToolTip, Mouse wheel acceleration speed: %MouseWheelAccelerationSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelMaxSpeedUp:
MouseWheelMaxSpeed++
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier &lt;= 0
MouseWheelSpeedMultiplier = 1
MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelMaxSpeedDown:
RegRead, MouseWheelSpeedMultiplier, HKCU, Control Panel\Desktop, WheelScrollLines
If MouseWheelSpeedMultiplier &lt;= 0
MouseWheelSpeedMultiplier = 1
If MouseWheelMaxSpeed &gt; 1
{
MouseWheelMaxSpeed--
MouseWheelMaxSpeedReal = %MouseWheelMaxSpeed%
MouseWheelMaxSpeedReal *= %MouseWheelSpeedMultiplier%
}
If MouseWheelMaxSpeedReal = 1
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% line
else
ToolTip, Mouse wheel maximum speed: %MouseWheelMaxSpeedReal% lines
SetTimer, RemoveToolTip, 1000
return
ButtonWheelUp:
ButtonWheelDown:
If Button &lt;&gt; 0
{
If Button &lt;&gt; %A_ThisHotkey%
{
MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseWheelSpeed%
}
}
StringReplace, Button, A_ThisHotkey, *
ButtonWheelAccelerationStart:
If MouseWheelAccelerationSpeed &gt;= 1
{
If MouseWheelMaxSpeed &gt; %MouseWheelCurrentSpeed%
{
Temp = 0.001
Temp *= %MouseWheelAccelerationSpeed%
MouseWheelCurrentAccelerationSpeed += %Temp%
MouseWheelCurrentSpeed += %MouseWheelCurrentAccelerationSpeed%
}
}
If Button = NumPadSub
MouseClick, wheelup,,, %MouseWheelCurrentSpeed%, 0, D
else if Button = NumPadAdd
MouseClick, wheeldown,,, %MouseWheelCurrentSpeed%, 0, D
SetTimer, ButtonWheelAccelerationEnd, 100
return
ButtonWheelAccelerationEnd:
GetKeyState, kstate, %Button%, P
if kstate = D
Goto ButtonWheelAccelerationStart
MouseWheelCurrentAccelerationSpeed = 0
MouseWheelCurrentSpeed = %MouseWheelSpeed%
Button = 0
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Override.htm" href="#Override.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Overriding or Disabling Hotkeys </span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">You can disable all built-in Windows hotkeys except Win+L and Win+U by making the following change to the registry (should work on all OSes, reboot is probably required):<br class="calibre12" /> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer<br class="calibre12" /> NoWinKeys REG_DWORD 0x00000001 (1)</p>
<p class="calibre8"> </p>
<p class="calibre8">But read on if you want to do more than just disable them all. Note that most of the below examples are not supported on Windows Me/98/95.</p>
<p class="calibre8"> </p>
<p class="calibre8">Hotkeys owned by another application can be overridden or disabled simply by assigning them to an action in the script. The most common use for this feature is to change the hotkeys that are built into Windows itself. For example, if you wish Win+E (the shortcut key that launches Windows Explorer) to perform some other action, use this:</p>
<p class="calibre8">#e::<br class="calibre12" /> MsgBox, This hotkey is now owned by the script.<br class="calibre12" /> return</p>
<p class="calibre8"> </p>
<p class="calibre8">In this next example, the Win+R hotkey, which is used to open the RUN window, is completely disabled:</p>
<p class="calibre8">#r::return</p>
<p class="calibre8"> </p>
<p class="calibre8">Similarly, to disable both Windows keys, use this:</p>
<p class="calibre8">Lwin::return<br class="calibre12" /> Rwin::return </p>
<p class="calibre8"> </p>
<p class="calibre8">To disable or change an application's non-global hotkey (that is, a shortcut key that only works when that application is the active window), consider the following example which disables Control+P (Print) only for Notepad, leaving the key in effect for all other types of windows:</p>
<p class="calibre8">$^p::<br class="calibre12" /> SetTitleMatchMode, 2 <br class="calibre12" /> IfWinActive, - Notepad, , Return<br class="calibre12" /> Send, ^p<br class="calibre12" /> return</p>
<p class="calibre8"> </p>
<p class="calibre8">In the above example, the $ prefix is needed so that the hotkey can "send itself" without activating itself (which would otherwise trigger a warning dialog about an infinite loop).</p>
<p class="calibre8"> </p>
<p class="calibre8">You can try out any of the above examples by copying them into a new text file such as "Override.ahk", then launching the file.</p>
<p class="calibre8"> </p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Performance.htm" href="#Performance.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Script &amp; Hotkey Performance </span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">Scripts are semi-compiled while they're being loaded and syntax-checked. In addition to reducing the memory consumed by the script, this process also enhances runtime performance (by orders of magnitude in some cases). The performance boost is greatest when <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a> is -1, meaning that the script is running at maximum speed.</p>
<p class="calibre8">In addition to <a href="#SetBatchLines.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetBatchLines</a>, the following commands may also affect performance depending on the nature of the script: <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a>, <a href="#SetMouseDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetMouseDelay</a>, <a href="#SetWinDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetWinDelay</a>, <a href="#SetControlDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetControlDelay</a>, and <a href="#SetDefaultMouseSpeed.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetDefaultMouseSpeed</a>.</p>
<hr class="calibre24" />
<p class="calibre8">Here are the technical details of the semi-compiling process:</p>
<ul class="calibre10">
<li class="calibre11">Input and output variables (when their names don't contain references to other variables) and <a href="#GroupAdd.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">group</a> names are resolved to memory addresses.</li>
<li class="calibre11"><a href="#Loop.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Loops</a>, <a href="#Block.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">blocks</a>, <a href="#IfEqual.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">IFs</a>, and <a href="#Else.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ELSEs</a> are given the memory addresses of their related jump-points in the script.</li>
<li class="calibre11">The destination of each <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a>,<a href="#Gosub.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2"> Gosub</a>, and <a href="#Goto.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Goto</a> is resolved to a memory address unless it's a variable. </li>
<li class="calibre11">Command names are replaced with their addresses in a jump table.</li>
<li class="calibre11">Each line is parsed into a list of parameters.</li>
<li class="calibre11">Each parameter is parsed into a list of variable references (if any).</li>
<li class="calibre11">Each variable reference is resolved to a memory address.</li>
</ul>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Remap.htm" href="#Remap.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Remapping Keyboard, Joystick, and Mouse </span></h2>
<div class="calibre42">
<hr size="2" class="calibre24" />
<p class="calibre8">There are two approaches to remapping: the simple and the comprehensive. The simple method uses the <a href="#Send.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Send</a> command to simulate input in place of the key or button you wish to remap. In this example, four of the left hand letter keys are converted from the QWERTY layout to Dvorak. This is not something you would necessarily do -- since there are utilities and operating system features more suitable for changing keyboard layout -- it just illustrates the technique:</p>
<p class="calibre8">#UseHook ; Needed for remapping keys to each other, e.g. A becomes B, and B becomes A. <br class="calibre12" /> s::Send, o<br class="calibre12" /> d::Send, e<br class="calibre12" /> f::Send, u<br class="calibre12" /> g::Send, i<br class="calibre12" /> +s::Send, O ; the plus sign indicates the shift key <br class="calibre12" /> +d::Send, E <br class="calibre12" /> +f::Send, U <br class="calibre12" /> +g::Send, I<br class="calibre12" /> Rwin::return ; This line disables the right windows key.</p>
<p class="calibre8">(See the <a href="#KeyList.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">key list</a> for a complete list of supported keys and mouse/joystick buttons)<br class="calibre12" /> (See also: <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkeys</a>)</p>
<p class="calibre8"> </p>
<p class="calibre8">The comprehensive method of remapping is useful when you want the substitution to be more complete, which is helpful for holding a key down in a game. It is also appropriate for mouse buttons and modifiers such as SHIFT, which have special behavior when they are held down. This first example makes a modifier key (Right-ALT) become a different modifier (CONTROL):</p>
<p class="calibre8">*RAlt:: ; The asterisk makes the remapping more complete on XP/2k/NT.<br class="calibre12" /> Send, {Control down}<br class="calibre12" /> KeyWait, RAlt ; Wait for the key to be released.<br class="calibre12" /> Send, {Control up}<br class="calibre12" /> return</p>
<p class="calibre8"><br class="calibre12" /> This next example makes the accent key (upper left corner of most English keyboards) <strong class="calibre14">become</strong> the left mouse button. The left mouse button itself is not changed:</p>
<p class="calibre8">*`::<br class="calibre12" /> MouseClick, left, , , 1, 0, D ; Hold down the left mouse button.<br class="calibre12" /> KeyWait, `` ; Wait for the key to be released.<br class="calibre12" /> ; Above requires double-accent due accent being the <a href="#h_EscapeChar.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">escape character</a>.<br class="calibre12" /> MouseClick, left, , , 1, 0, U ; Release the mouse button.<br class="calibre12" /> return</p>
<p class="calibre8"><br class="calibre12" /> Finally, <a href="#JoystickMouse.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">this script</a> converts a joystick into a two-button mouse by remapping its buttons and axis control.<br class="calibre12" />
<br class="calibre12" /> You can try out one of these examples by copying it into a new text file such as "Remap.ahk", then launching the file.
</p>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Seek_Search.htm" href="#Seek_Search.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Seek -- by Phi</h3>
<div class="calibre46">
<p class="calibre47"> Navigating the Start Menu can be a hassle, especially if you have installed many programs over time. 'Seek' lets you specify a case-insensitive key word/phrase that it will use to filter only the matching programs and directories from the Start Menu, so that you can easily open your target program from a handful of matched entries. This eliminates the drudgery of searching and traversing the Start Menu. </p>
<p class="calibre47"><a href="Seek_Search.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">;*****************************************************************
;
; Program : Seek
; Coder : Phi
; Updated : Sat Oct 23 01:54:50 2004
;
; What do you seek, my friend?
;
;*****************************************************************
;
; I have a lot of fun coding this, and hope you will
; enjoy using it too. Feel free to drop me an email with
; your comments and feedback at: phi1618 (*a.t*) gmail
; :D0T: com.
;
; Options:
; -cache Use the cached directory-listing if available
; (this is the default mode when no option is specified)
; -scan Force a directory scan to retrieve the latest
; directory listing
; -scex Scan &amp; exit (this is useful for scheduling the
; potentially time-consuming directory-scanning as
; a background job)
; -help Show this help
;
;*****************************************************************
;
; HOW TO 'SEEK':
;
; 1. 'Seek' is an AutoHotkey script. You can either run it
; as Seek.ahk (original script) or Seek.exe (compiled
; executable).
;
; To obtain Seek.exe, you can download Seek.zip (includes
; both the source code and the compiled binary) from
; http://home.ripway.com/2004-10/188589/
; Otherwise, you can compile Seek.ahk on your own by
; using AutoHotkey's Ahk2Exe.exe compiler, or you can
; ask me for a copy via email. The filesize is small at
; about 180 kbytes. I can be reached at: phi1618 (*a.t*)
; gmail :D0T: com.
;
; To use Seek.ahk, first, you'll need to install
; AutoHotkey v1.0.21 or higher on your PC (download from
; http://www.autohotkey.com). Next, run the command:
;
; X:\myTools\AutoHotkey\AutoHotkey.exe Y:\myAHK\Seek.ahk
;
; Remember to replace X:\myTools and Y:\myAHK with
; the proper directory names on your PC.
;
; 2. You can place the executable Seek.exe anywhere you
; want. There is no installation required, it doesn't
; write anything to your registry, and it doesn't
; access the Internet at all (no phoning home). To
; uninstall, simply delete Seek.exe.
;
; The only 2 files 'Seek' creates are placed in your
; TMP directory:
;
; a. _Seek.key (cache file for last query string)
; b. _Seek.list (cache file for directory listing)
;
; If you're a purist, you can delete them manually
; when you decide to remove 'Seek' from your system.
;
; 3. The most convenient way to run 'Seek' is via a
; shortcut/hotkey. If you are not already using any
; hotkey management program on your PC, I highly
; recommend AutoHotkey. If you don't intend to install
; any hotkey management program at the moment, you can
; make use of Windows shortcut feature and bind a
; shortcut key (e.g. ALT-F1) to launch 'Seek'. This is
; important so that you can run 'Seek' at anytime and
; anywhere.
;
; 4. When you run 'Seek' for the first time, it'll scan
; your Start Menu, and save the directory listing into
; a cache file.
;
; The following directories are included in the scanning:
; - %USERPROFILE%\Start Menu
; - ...\All Users\Start Menu
;
; By default, subsequent runs will read from the
; cache file so as to reduce the loading time. For
; more info on options, run 'Seek.exe -help'. If you
; think your Start Menu doesn't contain too many
; programs, you can choose not to use the cache and
; instruct 'Seek' to always do a directory scan (via
; option -scan). That way, you will always get the
; latest listing.
;
; 5. When you run 'Seek', a window will appear, waiting
; for you to enter a key word/phrase. After you have
; entered a query string, a list of matching records
; will be displayed. Next, you need to highlight an
; entry and press &lt;Enter&gt; or click on the 'Open'
; button to run the selected program or open the
; selected directory.
;
;*****************************************************************
;
; TECHNICAL NOTES:
;
; - 'Seek' requires Chris Mallett's AutoHotkey v1.0.21
; or higher version (http://www.autohotkey.com).
; Thanks to Chris for his great work on AutoHotkey. :)
;
; - The following environment variables must be valid:
; a. USERPROFILE
; b. COMSPEC
; c. TMP
;
;*****************************************************************
;
; IMPLEMENTED SUGGESTIONS:
;
; - Highlight 1st matching record by default so that
; user can just hit &lt;Enter&gt; to run it.
; (Suggested by Yih Yeong)
;
; - Enable double-click on the listing of the search
; results to launch the program.
; (Suggested by Yih Yeong &amp; Jack)
;
; - Auto real-time incremental search.
; (Suggested by Rajat)
;
;*****************************************************************
;
; SUGGESTED FEATURES (MAY OR MAY NOT BE IMPLEMENTED):
;
; - Log the launch history. List the most frequently
; used programs at the top of the search results.
; (Suggested by Yih Yeong)
;
; - Instead of using list box, can it display a series
; of application icons so that hovering the cursor
; over the icon will display a tooltip containing the
; program information (path, etc).
; (Suggested by Yih Yeong)
;
; - Instead of matching text in the middle, match only
; those program/directory names that begin with the
; query string.
; (Suggested by Stefan)
;
; - Add favorites management. Launch group of programs
; in a single run.
; (Suggested by Atomhrt)
;
; - Integrate Seek into the Windows taskbar/toolbar so that
; it is always available and there is no need to bind a
; hotkey to launch Seek.
; (Suggested by Deniz Akay)
;
;*****************************************************************
;
; CHANGE HISTORY:
;
; * v1.1.0
; - Initial release.
;
; * v1.1.1
; - Removed maximise-window option since some programs don't
; function well with it.
; - Added double-click detection to trigger 'Open' function.
;
; * v2.0.0
; - Integrated the 'Seek' popup window into the output screen
; so that user can re-enter the query string to search for
; something else without having to exit and run Seek again.
; - Added 'Scan Start-Menu' button.
; - Added real-time incremental search which will auto
; filter for matching records while you type away,
; without waiting for you to press &lt;Enter&gt;.
; - Added internal switch to track search string (ON/OFF)
; - Added internal switch to show filename in tooltip (ON/OFF)
;
; * v2.0.1
; - Added horizontal scrollbar to ListBox so that very
; long records will not be cut-off in the middle.
;
; * v2.0.2
; - Allowed user to add their own customised list of directories
; to be included in the scanning. User just needs to create a
; text file 'Seek.dir' in the same directory as Seek.exe or
; Seek.ahk, and specify the full path of the directory to be
; added, one directory per line. Do not enclose the path in
; quotes or double-quotes.
;
;*****************************************************************
;**************************
;&lt;--- BEGIN OF PROGRAM ---&gt;
;**************************
;==== Your Customisation ===================================
; Specify which program to use when opening a directory.
; If the program cannot be found or is not specified
; (i.e. variable is unassigned or assigned a null value),
; the default Explorer will be used.
dirExplorer = E:\utl\xplorer2_lite\xplorer2.exe
; User's customised list of additional directories to
; be included in the scanning. If this file is missing,
; only the default directories will be scanned.
SeekMyDir = %A_ScriptDir%\Seek.dir
; Specify the filename and directory location to save
; the cached directory/program listing. There is no
; need to change this unless you want to.
dirListing = %tmp%\_Seek.list
; Specify the filename and directory location to save
; the cached key word/phrase of last search. There is
; no need to change this unless you want to.
keyPhrase = %tmp%\_Seek.key
; Track search string (ON/OFF)
; If ON, the last-used query string will be re-used as
; the default query string the next time you run Seek.
; If OFF, the last-used query string will not be tracked
; and there will not be a default query string value the
; next time you run Seek.
TrackKeyPhrase = ON
;...........................................................
; INIT
#NoTrayIcon
StringCaseSense, Off
version = Seek v2.0.2
; SHOW FILENAME IN TOOLTIP (ON/OFF)
; WITH THE ADDITION OF THE HORIZONTAL SCROLLBAR IN THE
; LISTBOX, THERE IS NO NEED TO TURN ON THIS ANYMORE.
; KEEP IT AS OFF.
ToolTipFilename = OFF
; DISPLAY HELP INSTRUCTIONS
If 1 in --help,-help,/h,-h,/?,-?
{
MsgBox,, %version%, Navigating the Start Menu can be a hassle, especially if you have installed many programs over time. 'Seek' lets you specify a case-insensitive key word/phrase that it will use to filter only the matching programs and directories from the Start Menu, so that you can easily open your target program from a handful of matched entries. This eliminates the drudgery of searching and traversing the Start Menu.`n`nI have a lot of fun coding this, and hope you will enjoy using it too. Feel free to drop me an email with your comments and feedback at: phi1618 (*a.t*) gmail :D0T: com.`n`nOptions:`n -cache`tUse the cached directory-listing if available (this is the default mode when no option is specified)`n -scan`tForce a directory scan to retrieve the latest directory listing`n -scex`tScan &amp; exit (this is useful for scheduling the potentially time-consuming directory-scanning as a background job)`n -help`tShow this help
Goto QuitNoSave
}
; CHECK THAT THE MANDATORY ENVIRONMENT VARIABLES EXIST AND ARE VALID
; *USERPROFILE*
IfNotExist, %USERPROFILE% ; PATH DOES NOT EXIST
{
MsgBox This mandatory environment variable is either not defined or invalid:`n`n USERPROFILE = %USERPROFILE%`n`nPlease fix it before running Seek.
Goto QuitNoSave
}
; *COMSPEC*
IfNotExist, %COMSPEC% ; COMSPEC EXECUTABLE FILE DOES NOT EXIST
{
MsgBox This mandatory environment variable is either not defined or invalid:`n`n COMSPEC = %COMSPEC%`n`nPlease fix it before running Seek.
Goto QuitNoSave
}
; *TMP*
IfNotExist, %TMP% ; PATH DOES NOT EXIST
{
MsgBox This mandatory environment variable is either not defined or invalid:`n`n TMP = %TMP%`n`nPlease fix it before running Seek.
Goto QuitNoSave
}
; IF NOT SCAN-AND-EXIT
IfNotEqual 1, -scex
{
; RETRIEVE THE LAST USED KEY-PHRASE FROM CACHE FILE
; TO BE USED AS THE DEFAULT QUERY STRING
If TrackKeyPhrase = ON
FileReadLine, PrevKeyPhrase, %keyPhrase%, 1
NewKeyPhrase = %PrevKeyPhrase%
; ADD THE TEXT BOX FOR USER TO ENTER THE QUERY STRING
Gui, 1:Add, Edit, vFilename W600, %PrevKeyPhrase%
; ADD MY FAV TAGLINE
Gui, 1:Add, Text, X625 Y10, What do you seek, my friend?
; ADD THE SELECTION LISTBOX FOR DISPLAYING SEARCH RESULTS
Gui, 1:Add, ListBox, vOpenTarget gTargetSelection X10 Y33 R30 W764 HScroll, %List%
GuiControl, 1:Disable, OpenTarget
; ADD THE EXIT BUTTON. THIS ALSO SERVES TO FORCE THE GUI
; TO THE PROPER SIZE SO THAT SUBSEQUENT SHOW-COMMAND WILL
; NOT NEED TO DO ANY RESIZING. ALSO, THIS SOLVES THE
; MISSING-BUTTONS PROBLEM ON SOME PCs.
Gui, 1:Add, Button, gButtonEXIT X743 Y446, Exit
; POP-UP THE QUERY WINDOW
Gui, 1:Show, Center, %version%
}
; ENABLE RE-SCANNING OF LATEST DIRECTORY LISTING
If 1 in -scan,-scex
rescan = Y
; CHECK WHETHER THE DIRECTORY LISTING CACHE FILE ALREADY EXISTS. IF NOT, DO A RE-SCAN.
Else IfNotExist, %dirListing%
rescan = Y
If rescan = Y ; DO A RE-SCAN
{
; DISPLAY FEEDBACK TOOLTIP UNLESS USER SPECIFIES SCAN-AND-EXIT OPTION
IfNotEqual 1, -scex, Tooltip, Retrieving Directory Listing..., 0,503
; SCAN START-MENU AND STORE DIRECTORY/PROGRAM LISTINGS IN CACHE FILE
Gosub ScanStartMenu
; QUIT IF USER SPECIFIES SCAN-AND-EXIT OPTION
IfEqual 1, -scex, Goto, QuitNoSave
}
; RETRIEVE THE MATCHING LIST FOR THE LAST USED KEY-PHRASE
Gosub SilentFindMatches
; DIRECTORY LISTING IS NOW LOADED. ADD THE OTHER BUTTONS TO WINDOW.
; THESE BUTTONS ARE NOT ADDED EARLIER BECAUSE THEY SHOULD NOT BE
; FUNCTIONAL UNTIL THIS PART OF THE SCRIPT.
Gui, 1:Add, Button, gButtonOPEN Default X10 Y446, Open
Gui, 1:Add, Button, gButtonOPENDIR X59 Y446, Open Directory
Gui, 1:Add, Button, gButtonSCANSTARTMENU X340 Y446, Scan Start-Menu
; TURN ON INCREMENTAL SEARCH
SetTimer, tIncrementalSearch, 500
; REFRESH THE GUI
Gosub EnterQuery
Return
;*****************************
;&lt;--- END OF MAIN PROGRAM ---&gt;
;*****************************
;=== BEGIN ButtonSCANSTARTMENU EVENT =======================
ButtonSCANSTARTMENU:
Gui, 1:Submit, NoHide
; DISABLE LISTBOX WHILE SCANNING IS IN PROGRESS
GuiControl, 1:Disable, OpenTarget
; DO THE SCANNING
Gosub ScanStartMenu
; INFORM USER THAT SCANNING HAS COMPLETED
If Filename =
{
MsgBox, 8192, %version%, Scan completed.
Gosub EnterQuery
}
Else
{
; FILTER FOR SEARCH STRING WITH THE NEW LISTING
MsgBox, 8192, %version%, Scan completed. Press OK to proceed to search for "%Filename%".
NewKeyPhrase =
Gosub FindMatches
}
Return
;... END ButtonSCANSTARTMENU EVENT .........................
;=== BEGIN ScanStartMenu SUBROUTINE ========================
; SCAN THE START-MENU AND STORE THE DIRECTORY/PROGRAM
; LISTINGS IN A CACHE FILE
ScanStartMenu:
; DEFINE THE DIRECTORY PATHS TO RETRIEVE
scanPath = "%USERPROFILE%\Start Menu"
SplitPath, USERPROFILE, name, dir, ext, name_no_ext, drive
scanPath = %scanPath% "%dir%\All Users\Start Menu"
; INCLUDE ADDITIONAL USER-DEFINED PATHS FOR SCANNING
IfExist, %SeekMyDir%
{
Loop, read, %SeekMyDir%
{
IfNotExist, %A_LoopReadLine%
MsgBox, 8192, %version%, Processing your customised directory list...`n`n"%A_LoopReadLine%" does not exist and will be excluded from the scanning.`nPlease update [ %SeekMyDir% ].
Else
scanPath = %scanPath% "%A_LoopReadLine%"
}
}
; DELETE EXISTING FILE BEFORE CREATING A NEW VERSION
FileDelete, %dirListing%
; ACTUAL RETRIEVAL OF DIRECTORY LISTING IS DONE VIA THE 'DIR' COMMAND
RunWait, %COMSPEC% /c dir /s /b %scanPath% &gt; %dirListing% ,,Hide
; HIDE THE FEEDBACK TOOLTIP WHEN SCANNING IS DONE
Tooltip
Return
;... END ScanStartMenu SUBROUTINE ..........................
;=== BEGIN FindMatches SUBROUTINE ==========================
; SEARCH AND DISPLAY ALL MATCHING RECORDS IN THE LISTBOX
FindMatches:
Gui, 1:Submit, NoHide
Tooltip
; CHECK FOR EMPTY QUERY STRING
If Filename =
{
MsgBox, 8192, %version%, Please enter the key word/phrase to search for.
Goto EnterQuery
}
; tIncrementalSearch IS BEING INTERRUPTED. LET IT FINISHES.
If NewKeyPhrase &lt;&gt; %Filename%
{
; INFORM USER THAT PATIENCE IS A VIRTUE
Tooltip, Seeking for matching records..., 0,503
ResumeFindMatches = TRUE
Return
}
If List = |
{
; NOT EVEN A SINGLE MATCHING RECORD IS FOUND.
; LET USER MODIFY THE QUERY STRING AND TRY AGAIN.
MsgBox, 8192, %version%, The query string "%Filename%" does not match any record. Try again.
GuiControl, 1:Disable, OpenTarget
Goto EnterQuery
}
Else
{
; SELECT THE FIRST RECORD IF NO OTHER RECORD HAS BEEN SELECTED
Gui, 1:Submit, NoHide
GuiControl, 1:Enable, OpenTarget
GuiControl, Focus, OpenTarget
If OpenTarget =
GuiControl, 1:Choose, OpenTarget, |1
}
; REFRESH GUI
Gui, 1:Show, Center, %version%
Return
;... END FindMatches SUBROUTINE ............................
;=== BEGIN SilentFindMatches SUBROUTINE ====================
SilentFindMatches:
Gui, 1:Submit, NoHide
sfmFilename = %Filename%
; FILTER MATCHING RECORDS BASED ON USER QUERY STRING
List = |
If sfmFilename &lt;&gt;
{
Loop, read, %dirListing%
{
Gui, 1:Submit, NoHide
If sfmFilename &lt;&gt; %Filename%
{
; USER HAS CHANGED THE SEARCH STRING. THERE IS NO POINT
; TO CONTINUE SEARCHING USING THE OLD STRING, SO ABORT.
Return
}
Else
{
; APPEND MATCHING RECORDS INTO THE LIST
SplitPath, A_LoopReadLine, name, dir, ext, name_no_ext, drive
IfInString, name, %sfmFilename%
List = %List%%A_LoopReadLine%|
}
}
}
; REFRESH LIST WITH SEARCH RESULTS
GuiControl, 1:, OpenTarget, %List%
If List = |
{
; NO MATCHING RECORD IS FOUND
; DISABLE LISTBOX
GuiControl, 1:Disable, OpenTarget
}
Else
{
; MATCHING RECORDS ARE FOUND
; ENABLE LISTBOX
GuiControl, 1:Enable, OpenTarget
}
; REFRESH GUI
Gui, 1:Show, Center, %version%
Return
;... END SilentFindMatches SUBROUTINE ......................
;=== BEGIN EnterQuery SUBROUTINE ===========================
; REFRESH GUI AND LET USER ENTERS SEARCH STRING
EnterQuery:
GuiControl, Focus, Filename
Gui, 1:Show, Center, %version%
Return
;... END EnterQuery SUBROUTINE .............................
;=== BEGIN TargetSelection EVENT ===========================
TargetSelection:
Gui, 1:Submit, NoHide
; DOUBLE-CLICK DETECTION TO LAUNCH PROGRAM
If A_GuiControlEvent = DoubleClick
{
Gosub ButtonOPEN
}
Else
{
; DISPLAY THE TOOLTIP FOR THE CURRENTLY HIGHLIGHTED RECORD.
; THIS IS USEFUL IF THE RECORD IS TOO LONG AND COULDN'T FIT IN THE WINDOW.
; THE TOOLTIP WILL SHOW YOU THE COMPLETE PATH AND FILE NAME.
If A_GuiControlEvent = Normal
{
If ToolTipFilename = ON
{
Tooltip, %OpenTarget%, 0,503
SetTimer, tRemoveTip, 6000 ; REMOVE TOOLTIP AFTER 6 SECS
}
}
}
Return
;... END TargetSelection EVENT .............................
;=== BEGIN ButtonOPEN EVENT ================================
; USER CLICKED ON 'OPEN' BUTTON OR PRESSED &lt;ENTER&gt;
ButtonOPEN:
Gui, 1:Submit, NoHide
; FIND OUT WHERE THE KEYBOARD FOCUS WAS. IF IT'S THE
; TEXT FIELD, RUN THE QUERY TO FIND MATCHES. ELSE, IT
; MUST BE FROM THE LISTBOX.
GuiControlGet, focusControl, 1:Focus
If focusControl = Edit1
{
GuiControl, Focus, OpenTarget
GuiControl, 1:Disable, OpenTarget
Goto FindMatches
}
; NO RECORD FROM THE LISTBOX IS SELECTED
If OpenTarget =
{
MsgBox, 8192, %version%, Please make a selection before hitting &lt;Enter&gt;.`nPress &lt;Esc&gt; to exit.
Goto EnterQuery
}
; SELECTED RECORD DOES NOT EXIST (FILE OR DIRECTORY NOT FOUND)
IfNotExist, %OpenTarget%
{
MsgBox, 8192, %version%, %OpenTarget% does not exist. This means that the directory cache is outdated. You may click on the 'Scan Start-Menu' button below to update the directory cache with your latest directory listing now.
Goto EnterQuery
}
; CHECK WHETHER THE SELECTED RECORD IS A FILE OR DIRECTORY
FileGetAttrib, fileAttrib, %OpenTarget%
IfInString, fileAttrib, D ; IS DIRECTORY
{
Gosub sOpenDir
}
Else If fileAttrib &lt;&gt; ; IS FILE
{
Run, %OpenTarget%
}
Else
{
MsgBox %OpenTarget% is neither a DIRECTORY or a FILE. This shouldn't happen. Seek cannot proceed. Quitting...
}
Goto Quit
;... END ButtonOPEN EVENT ..................................
;=== BEGIN ButtonOPENDIR EVENT =============================
; USER CLICKED ON 'OPEN DIRECTORY' BUTTON
ButtonOPENDIR:
Gui, 1:Submit, NoHide
; CHECK THAT USER HAS SELECTED A RECORD ALREADY
If OpenTarget =
{
MsgBox, 8192, %version%, Please make a selection first.
Goto EnterQuery
}
; RUN SUBROUTINE TO OPEN A DIRECTORY
Gosub sOpenDir
Goto Quit
;... END ButtonOPENDIR EVENT ...............................
;=== BEGIN sOpenDir SUBROUTINE =============================
sOpenDir:
; IF USER SELECTED A FILE-RECORD INSTEAD OF A DIRECTORY-RECORD,
; EXTRACT THE DIRECTORY PATH. (I'M USING DriveGet INSTEAD OF
; FileGetAttrib TO ALLOW THE SCENARIO WHEREBY OpenTarget IS
; INVALID BUT THE DIRECTORY PATH OF OpenTarget IS VALID.
DriveGet, status, status, %OpenTarget%
If status &lt;&gt; Ready ; NOT A DIRECTORY
{
SplitPath, OpenTarget, name, dir, ext, name_no_ext, drive
OpenTarget = %dir%
}
; CHECK WHETHER DIRECTORY EXISTS
IfNotExist, %OpenTarget%
{
MsgBox, 8192, %version%, %OpenTarget% does not exist. This means that the directory cache is outdated. You may click on the 'Scan Start-Menu' button below to update the directory cache with your latest directory listing now.
Goto EnterQuery
}
; OPEN THE DIRECTORY
IfExist, %dirExplorer%
{
Run, "%dirExplorer%" "%OpenTarget%", , Max ; OPEN WITH CUSTOMISED FILE EXPLORER
}
Else
{
Run, %OpenTarget%, , Max ; OPEN WITH DEFAULT WINDOWS FILE EXPLORER
}
Return
;... END subOpenDir SUBROUTINE .............................
;=== BEGIN tIncrementalSearch EVENT ========================
; AUTOMATICALLY CONDUCT REAL-TIME INCREMENTAL SEARCH
; TO FIND MATCHING RECORDS WITHOUT WAITING FOR USER
; TO PRESS &lt;ENTER&gt;
tIncrementalSearch:
Loop
; REPEAT SEARCHING UNTIL USER HAS STOPPED CHANGING THE QUERY STRING
{
Gui, 1:Submit, NoHide
CurFilename = %Filename%
If NewKeyPhrase &lt;&gt; %CurFilename%
{
OpenTarget =
Gosub SilentFindMatches
NewKeyPhrase = %CurFilename%
Sleep, 100 ; DON'T HOG THE CPU!
}
Else
{
; QUERY STRING HAS STOPPED CHANGING
Break
}
}
; USER HAS HIT &lt;ENTER&gt; TO LOOK FOR MATCHING RECORDS.
; RUN FindMatches NOW.
If ResumeFindMatches = TRUE
{
ResumeFindMatches = FALSE
Gosub FindMatches
}
; CONTINUE MONITORING FOR CHANGES
SetTimer, tIncrementalSearch, 500
Return
;... END tIncrementalSearch EVENT ..........................
;=== BEGIN tRemoveTip EVENT ================================
; REMOVE TOOLTIP
tRemoveTip:
SetTimer, tRemoveTip, Off
ToolTip
Return
;... END tRemoveTip EVENT ..................................
;=== BEGIN Quit SUBROUTINE =================================
Quit:
ButtonEXIT:
GuiClose:
GuiEscape:
Gui, 1:Submit, NoHide
; SAVE THE KEY WORD/PHRASE FOR NEXT RUN IF IT HAS CHANGED
If TrackKeyPhrase = ON
{
If PrevKeyPhrase &lt;&gt; %Filename%
{
FileDelete, %keyPhrase%
FileAppend, %Filename%, %keyPhrase%
}
}
QuitNoSave:
ExitApp ; JOB DONE. G'DAY!
;... END Quit SUBROUTINE ...................................
;************************
;&lt;--- END OF PROGRAM ---&gt;
;************************
; /* vim: set noexpandtab shiftwidth=4: */
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Threads.htm" href="#Threads.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Threads</span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">The <em class="calibre21">current thread</em> is defined as the flow of execution invoked by the most recent <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed subroutine</a>, or <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>. That thread can be executing commands within its own subroutine or within other subroutines called by that subroutine.<br class="calibre12" />
<br class="calibre12" /> Although AutoHotkey doesn't actually use multiple threads, it simulates that behavior: If a second thread is started -- such as by pressing another hotkey while the previous is still running -- the <em class="calibre21">current thread</em> will be interrupted (temporarily halted) to allow the new thread to become <em class="calibre21">current</em>. If third thread is started while the second is still running, both the second and first will be in a dormant state, and so on.<br class="calibre12" />
<br class="calibre12" /> When the <em class="calibre21">current thread</em> finishes, the one most recently interrupted will be resumed, and so on, until all the threads finally finish. When resumed, a thread's settings for things such as <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> and <a href="#SetKeyDelay.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetKeyDelay</a> are automatically restored to what they were just prior to its interruption; in other words, a thread will experience no side-effects from having been interrupted (except for a possible change in the <a href="#WinActivate.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">active window</a>).<br class="calibre12" />
<br class="calibre12" /> Note: The <a href="#KeyHistory.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">KeyHistory</a> command/menu-item shows how many threads are in an interrupted state and the <a href="#ListHotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ListHotkeys</a> command/menu-item shows which hotkeys have threads. <br class="calibre12" />
<br class="calibre12" /> Related to the above: A single script can have multiple simultaneous <a href="#MsgBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">MsgBox</a>, <a href="#InputBox.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">InputBox</a>, <a href="#FileSelectFile.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFile</a>, and <a href="#FileSelectFolder.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">FileSelectFolder</a> dialogs. This is achieved by launching a new thread (via <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed subroutine</a>, or <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a>) while a prior thread already has a dialog displayed. <br class="calibre12" />
<br class="calibre12" /> By default, a given <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> or <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstring</a> subroutine cannot be run a second time if it is already running. Use <a href="#h_MaxThreadsPerHotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#MaxThreadsPerHotkey</a> to change this behavior.
</p>
<p class="calibre8"> </p>
<p class="calibre8"><span class="calibre17"><u class="calibre20">Thread Priority</u></span></p>
<p class="calibre8">A <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a>, <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">timed subroutine</a>, or <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">custom menu item</a> with a priority lower than that of the <em class="calibre21">current thread</em> cannot interrupt it. During that time, such timers will not run, and pressing such a hotkey or selecting such a custom menu item will have no effect (nor will it be buffered). Because of this, it is usually best to design high priority threads to finish quickly, or avoid making them high priority.</p>
<p class="calibre8">The default priority is 0. All threads use the default priority unless changed by one of the following methods:<br class="calibre12" /> 1) A timed subroutine is given a specific priority via <a href="#SetTimer.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SetTimer</a>.<br class="calibre12" /> 2) A hotkey is given a specific priority via the <a href="#Hotkey.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Hotkey</a> command.<br class="calibre12" /> 3) A <a href="#Hotstrings.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotstring</a> is given a specific priority when it is defined, or via the <a href="#h_Hotstring.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">#Hotstring</a> directive. <br class="calibre12" /> 4) A custom menu item is given a specific priority via the <a href="#Menu.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Menu</a> command.<br class="calibre12" /> 5) The <em class="calibre21">current thread</em> sets its own priority via the <a href="#Thread.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Thread</a> command.</p>
<p class="calibre8">The <a href="#OnExit.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">OnExit</a> subroutine (if any) will always run when called for, regardless of the <em class="calibre21">current thread</em>'s priority.</p>
</div>
</div>
<div class="tbd">
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="TooltipMouseMenu.htm" href="#TooltipMouseMenu.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">ToolTip Mouse Menu (requires XP/2k/NT) -- by Rajat</h3>
<div class="calibre46">
<p class="calibre47"> This script displays a popup menu in response to briefly holding down the middle mouse button. Select a menu item by left-clicking it. Cancel the menu by left-clicking outside of it. A recent improvement is that the contents of the menu can change depending on which type of window is active (Notepad and Word are used as examples here). </p>
<p class="calibre47"><a href="TooltipMouseMenu.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">; You can set any title here for the menu:
MenuTitle = -=-=-=-=-=-=-=-
; This is how long the mouse button must be held to cause the menu to appear:
UMDelay = 20
SetFormat, float, 0.0
SetBatchLines, 10ms
SetTitleMatchMode, 2
#SingleInstance
;___________________________________________
;_____Menu Definitions______________________
; Create / Edit Menu Items here.
; You can't use spaces in keys/values/section names.
; Don't worry about the order, the menu will be sorted.
MenuItems = Notepad/Calculator/Section 3/Section 4/Section 5
;___________________________________________
;______Dynamic menuitems here_______________
; Syntax:
; Dyn# = MenuItem|Window title
Dyn1 = MS Word|- Microsoft Word
Dyn2 = Notepad II|- Notepad
;___________________________________________
Exit
;___________________________________________
;_____Menu Sections_________________________
; Create / Edit Menu Sections here.
Notepad:
Run, Notepad.exe
Return
Calculator:
Run, Calc
Return
Section3:
MsgBox, You selected 3
Return
Section4:
MsgBox, You selected 4
Return
Section5:
MsgBox, You selected 5
Return
MSWord:
msgbox, this is a dynamic entry (word)
Return
NotepadII:
msgbox, this is a dynamic entry (notepad)
Return
;___________________________________________
;_____Hotkey Section________________________
~MButton::
HowLong = 0
Loop
{
HowLong ++
Sleep, 10
GetKeyState, MButton, MButton, P
IfEqual, MButton, U, Break
}
IfLess, HowLong, %UMDelay%, Return
;prepares dynamic menu
DynMenu =
Loop
{
IfEqual, Dyn%a_index%,, Break
StringGetPos, ppos, dyn%a_index%, |
StringLeft, item, dyn%a_index%, %ppos%
ppos += 2
StringMid, win, dyn%a_index%, %ppos%, 1000
IfWinActive, %win%,
DynMenu = %DynMenu%/%item%
}
;Joins sorted main menu and dynamic menu
Sort, MenuItems, D/
TempMenu = %MenuItems%%DynMenu%
;clears earlier entries
Loop
{
IfEqual, MenuItem%a_index%,, Break
MenuItem%a_index% =
}
;creates new entries
Loop, Parse, TempMenu, /
{
MenuItem%a_index% = %a_loopfield%
}
;creates the menu
Menu = %MenuTitle%
Loop
{
IfEqual, MenuItem%a_index%,, Break
numItems ++
StringTrimLeft, MenuText, MenuItem%a_index%, 0
Menu = %Menu%`n%MenuText%
}
MouseGetPos, mX, mY
HotKey, ~LButton, MenuClick
HotKey, ~LButton, On
ToolTip, %Menu%, %mX%, %mY%
WinActivate, %MenuTitle%
Return
MenuClick:
HotKey, ~LButton, Off
IfWinNotActive, %MenuTitle%
{
ToolTip
Return
}
MouseGetPos, mX, mY
ToolTip
mY -= 3 ;space after which first line starts
mY /= 13 ;space taken by each line
IfLess, mY, 1, Return
IfGreater, mY, %numItems%, Return
StringTrimLeft, TargetSection, MenuItem%mY%, 0
StringReplace, TargetSection, TargetSection, %a_space%,, A
Gosub, %TargetSection%
Return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="TutorialLaunchHelp.htm" href="#TutorialLaunchHelp.htm">#</a>
<div class="calibre16">
<h2 class="calibre9">AutoHotkey Tutorial - Launch a program or document (continued) </h2>
</div>
<p class="calibre8">To have a program or document start off maximized, minimized, or hidden, consider the following <a href="#Hotkeys.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">hotkey</a> subroutine, which assigns the Win+Z hotkey to launch two instances of Notepad, the 1st maximized and the 2nd minimized:<br class="calibre12" /> #z::<br class="calibre12" /> Run, Notepad, , max<br class="calibre12" /> Run, Notepad, , min<br class="calibre12" /> return<br class="calibre12" />
<br class="calibre12" /> To have a program use a specific folder as its working directory, consider this Win+C hotkey which creates a command prompt window in the specified directory:<br class="calibre12" /> #c::Run, %comspec% /k, C:\My Documents<br class="calibre12" />
<br class="calibre12" /> In the above example, the %comspec% <a href="#Variables.htm__env" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">environment variable</a> might resolve to C:\Windows\system32\cmd.exe on a typical system.<br class="calibre12" />
<br class="calibre12" /> To pass parameters, add them immediately after the name of the program or document as in these examples:<br class="calibre12" /> Run, %comspec% /k dir, C:\My Documents <br class="calibre12" /> Run, Notepad.exe "C:\My Documents\Address List.txt"<br class="calibre12" /> Run, %ProgramFiles%\AutoHotkey\AutoHotkey.exe "C:\Scripts\Test Script.ahk" param1 "param2 with spaces" param3<br class="calibre12" />
<br class="calibre12" /> In the 2nd and 3rd examples, parameters with spaces in them are enclosed in double quotes, which as a rule is the safest practice. By contrast, the working directory should not be enclosed in double quotes even if it contains spaces, such as in the 1st example above.<br class="calibre12" />
<br class="calibre12" /> Certain special words known as <em class="calibre21">system verbs</em> are also supported. The first example below opens the Explorer's properties dialog for the indicated file. The second example prints the specified document:<br class="calibre12" /> Run, properties "C:\Address List.txt"<br class="calibre12" /> Run, print C:\Address List.txt<br class="calibre12" />
<br class="calibre12" />
<a href="#Run.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">RunWait</a> sets the built-in <a href="#ErrorLevel.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ErrorLevel</a> variable to the exit code of the program it ran. For example, the following will display a non-zero ErrorLevel because the comspec program is indicating that a problem occurred:<br class="calibre12" /> RunWait, %comspec% /c dir c:\NonExistent.txt, , hide<br class="calibre12" /> MsgBox, %ErrorLevel%<br class="calibre12" />
<br class="calibre12" />
<a href="#TutorialHelp.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">Return to the Tutorial Table of Contents</a>
</p>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="VolumeOSD.htm" href="#VolumeOSD.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Volume On-Screen-Display (OSD) -- by Rajat</h3>
<div class="calibre46">
<p class="calibre47"> This script assigns hotkeys of your choice to raise and lower the master and/or wave volume. Both volumes are displayed as different color bar graphs. </p>
<p class="calibre47"><a href="VolumeOSD.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">;_________________________________________________
;_______User Settings_____________________________
; Make customisation only in this area or hotkey area only!!
; The percentage by which to raise or lower the volume each time:
vol_Step = 4
; How long to display the volume level bar graphs:
vol_DisplayTime = 2000
; Master Volume Bar color (see the help file to use more
; precise shades):
vol_CBM = Red
; Wave Volume Bar color
vol_CBW = Blue
; Background color
vol_CW = Silver
; Bar's screen position. Use -1 to center the bar in that dimension:
vol_PosX = -1
vol_PosY = -1
vol_Width = 150 ; width of bar
vol_Thick = 12 ; thickness of bar
; If your keyboard has multimedia buttons for Volume, you can
; try changing the below hotkeys to use them by specifying
; Volume_Up, ^Volume_Up, Volume_Down, and ^Volume_Down:
HotKey, #Up, vol_MasterUp ; Win+UpArrow
HotKey, #Down, vol_MasterDown
HotKey, +#Up, vol_WaveUp ; Shift+Win+UpArrow
HotKey, +#Down, vol_WaveDown
;___________________________________________
;_____Auto Execute Section__________________
; DON'T CHANGE ANYTHING HERE (unless you know what you're doing).
vol_BarOptionsMaster = 1:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBM% CW%vol_CW%
vol_BarOptionsWave = 2:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBW% CW%vol_CW%
; If the X position has been specified, add it to the options.
; Otherwise, omit it to center the bar horizontally:
if vol_PosX &gt;= 0
{
vol_BarOptionsMaster = %vol_BarOptionsMaster% X%vol_PosX%
vol_BarOptionsWave = %vol_BarOptionsWave% X%vol_PosX%
}
; If the Y position has been specified, add it to the options.
; Otherwise, omit it to have it calculated later:
if vol_PosY &gt;= 0
{
vol_BarOptionsMaster = %vol_BarOptionsMaster% Y%vol_PosY%
vol_PosY_wave = %vol_PosY%
vol_PosY_wave += %vol_Thick%
vol_BarOptionsWave = %vol_BarOptionsWave% Y%vol_PosY_wave%
}
#SingleInstance
SetBatchLines, 10ms
Return
;___________________________________________
vol_WaveUp:
SoundSet, +%vol_Step%, Wave
Gosub, vol_ShowBars
return
vol_WaveDown:
SoundSet, -%vol_Step%, Wave
Gosub, vol_ShowBars
return
vol_MasterUp:
SoundSet, +%vol_Step%
Gosub, vol_ShowBars
return
vol_MasterDown:
SoundSet, -%vol_Step%
Gosub, vol_ShowBars
return
vol_ShowBars:
; To prevent the "flashing" effect, only create the bar window if it
; doesn't already exist:
IfWinNotExist, vol_Wave
Progress, %vol_BarOptionsWave%, , , vol_Wave
IfWinNotExist, vol_Master
{
; Calculate position here in case screen resolution changes while
; the script is running:
if vol_PosY &lt; 0
{
; Create the Wave bar just above the Master bar:
WinGetPos, , vol_Wave_Posy, , , vol_Wave
vol_Wave_Posy -= %vol_Thick%
Progress, %vol_BarOptionsMaster% Y%vol_Wave_Posy%, , , vol_Master
}
else
Progress, %vol_BarOptionsMaster%, , , vol_Master
}
; Get both volumes in case the user or an external program changed them:
SoundGet, vol_Master, Master
SoundGet, vol_Wave, Wave
Progress, 1:%vol_Master%
Progress, 2:%vol_Wave%
SetTimer, vol_BarOff, %vol_DisplayTime%
return
vol_BarOff:
SetTimer, vol_BarOff, off
Progress, 1:Off
Progress, 2:Off
return
</pre>
</div>
</div>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="Winamp.htm" href="#Winamp.htm">#</a>
<h2 class="calibre9"><span class="calibre23">Automating Winamp </span></h2>
<hr size="2" class="calibre24" />
<p class="calibre8">This section demonstrates how to control Winamp via hotkey even when it is minimized or inactive. This information has been tested with Winamp 2.78c and should work for Winamp 2.x and possibly other major releases as well. Please post changes and improvements in the forum or contact the author.</p>
<p class="calibre8">This example makes the Ctrl+Alt+P hotkey equivalent to pressing Winamp's pause/unpause button:</p>
<pre class="calibre22">^!p::
SetTitleMatchMode, 2
IfWinNotExist, - Winamp
IfWinNotExist, Winamp 2. ; Adjust this if your Winamp is not 2.x
return
; Otherwise, the above has set the "last found" window for us:
<a href="#ControlSend.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">ControlSend</a>, ahk_parent, c ; Pause/Unpause
return</pre>
<p class="calibre8">Here are some of the keyboard shortcuts available in Winamp 2.x (may work in other versions too). The above example can be revised to use any of these keys: </p>
<table border="1" bordercolor="#C0C0C0" cellpadding="3" cellspacing="0" width="50%" class="calibre1">
<tbody class="calibre2">
<tr class="calibre3">
<td class="calibre4"><strong class="calibre14">Key to send </strong></td>
<td class="calibre4"><strong class="calibre14">Effect</strong></td>
</tr>
<tr class="calibre3">
<td class="calibre4">c</td>
<td class="calibre4">Pause/UnPause</td>
</tr>
<tr class="calibre3">
<td class="calibre4">x</td>
<td class="calibre4">Play/Restart/UnPause</td>
</tr>
<tr class="calibre3">
<td width="29%" class="calibre4">v</td>
<td width="71%" class="calibre4">Stop</td>
</tr>
<tr class="calibre3">
<td class="calibre4">+v</td>
<td class="calibre4">Stop with Fadeout </td>
</tr>
<tr class="calibre3">
<td class="calibre4">^v</td>
<td class="calibre4">Stop after the current track </td>
</tr>
<tr class="calibre3">
<td class="calibre4">b</td>
<td class="calibre4">Next Track </td>
</tr>
<tr class="calibre3">
<td class="calibre4">z</td>
<td class="calibre4">Previous Track </td>
</tr>
<tr class="calibre3">
<td class="calibre4">{left}</td>
<td class="calibre4">Rewind 5 seconds </td>
</tr>
<tr class="calibre3">
<td class="calibre4">{right}</td>
<td class="calibre4">Fast-forward 5 seconds </td>
</tr>
<tr class="calibre3">
<td class="calibre4">{up}</td>
<td class="calibre4">Turn Volume Up </td>
</tr>
<tr class="calibre3">
<td class="calibre4">{down}</td>
<td class="calibre4">Turn Volume Down </td>
</tr>
</tbody>
</table>
<p class="calibre8"> </p>
<pre class="calibre22">; This next example asks Winamp which track number is currently active:
SetTitleMatchMode, 2
<a href="#PostMessage.htm" class="pcalibre3 pcalibre1 pcalibre calibre5 pcalibre2">SendMessage</a>, 1024, 0, 120, - Winamp
if ErrorLevel &lt;&gt; FAIL
{
ErrorLevel++ ; Winamp's count starts at 0, so adjust by 1.
MsgBox, Track #%ErrorLevel% is active or playing.
}</pre>
</div>
</div>
<div class="calibreMain">
<div class="calibreEbookContent">
<a id="WindowShading.htm" href="#WindowShading.htm">#</a>
<div class="calibre44">
<h3 class="calibre45">Window Shading (roll up a window to its title bar) -- by Rajat</h3>
<div class="calibre46">
<p class="calibre47"> This script reduces a window to its title bar and then back to its original size by pressing a single hotkey. Any number of windows can be reduced in this fashion (the script remembers each). If the script exits for any reason, all "rolled up" windows will be automatically restored to their original heights. </p>
<p class="calibre47"><a href="WindowShading.ahk">Download This Script</a>  |  <a href="#index.htm">Other Sample Scripts</a>  |  <a href="http://www.autohotkey.com">Home</a></p>
<hr class="calibre24" />
<pre class="calibre48">; Set the height of a rolled up window here. The operating system
; probably won't allow the title bar to be hidden regardless of
; how low this number is:
ws_MinHeight = 25
; This line will unroll any rolled up windows if the script exits
; for any reason:
OnExit, ExitSub
return ; End of auto-execute section
#z:: ; Change this line to pick a different hotkey.
; Below this point, no changes should be made unless you want to
; alter the script's basic functionality.
; Uncomment this next line if this subroutine is to be converted
; into a custom menu item rather than a hotkey. The delay allows
; the active window that was deactivated by the displayed menu to
; become active again:
;Sleep, 200
WinGet, ws_ID, ID, A
Loop, Parse, ws_IDList, |
{
IfEqual, A_LoopField, %ws_ID%
{
; Match found, so this window should be restored (unrolled):
StringTrimRight, ws_Height, ws_Window%ws_ID%, 0
WinMove, ahk_id %ws_ID%,,,,, %ws_Height%
StringReplace, ws_IDList, ws_IDList, |%ws_ID%
return
}
}
WinGetPos,,,, ws_Height, A
ws_Window%ws_ID% = %ws_Height%
WinMove, ahk_id %ws_ID%,,,,, %ws_MinHeight%
ws_IDList = %ws_IDList%|%ws_ID%
return
ExitSub:
Loop, Parse, ws_IDList, |
{
if A_LoopField = ; First field in list is normally blank.
continue ; So skip it.
StringTrimRight, ws_Height, ws_Window%A_LoopField%, 0
WinMove, ahk_id %A_LoopField%,,,,, %ws_Height%
}
ExitApp ; Must do this for the OnExit subroutine to actually Exit the script.
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Scrolling to anchor via url works, but on refresh or navigation browsers ignore them
function go_to_hash() {
document.getElementById(location.hash.slice(1) || 'AutoHotkey.htm').scrollIntoView()
}
go_to_hash()
window.addEventListener('hashchange', go_to_hash, false)
//////
// Always highlight current section in navigation
let content = document.querySelector('.content')
let toc = document.querySelector('.calibreTocIndex')
let last_toc_link = null
function highlight_current() {
let rect = content.getBoundingClientRect()
let id = document.elementFromPoint(rect.x, rect.y)
.querySelector('a[id]')?.id
if(!id) return
let toc_link = toc.querySelector(`a[href="#${id}"]`)
if(!toc_link || last_toc_link === toc_link) return
toc_link.classList.add('current')
last_toc_link?.classList.remove('current')
last_toc_link = toc_link
toc_link.scrollIntoView({ block: 'center' })
}
let debouncer = 0
content.addEventListener('scroll', () => {
clearTimeout(debouncer)
debouncer = setTimeout(highlight_current, 100)
})
highlight_current()
</script>
</body>
</html>