We make this dedication for the benefit of the public ; at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of ; relinquishment in perpetuity of all present and future rights to this software under copyright law. Persistent ; If the script is already running when a new instance is initialized, this skips the prompt dialog ; box and replaces the old instance automatically, which is similar in effect to the Reload command.
Using variables and the clipboard Repeating a series of actions over and over Manipulating files and folders Overview of other features Creating a script Each script is a plain text file containing commands to be executed by the program AutoHotkey.
A script may also contain hotkeys and hotstrings, or even consist entirely of them. However, in the absence of hotkeys and hotstrings, a script will perform its commands sequentially from top to bottom the moment it is launched.
To create a new script: Download and install AutoHotkey. Right-click an empty spot on your desktop or in a folder of your choice.
Type a name for the file, ensuring that it ends in. On a new blank line, type the following: In the line above, the first character " " stands for the Windows key; so space means holding down the Windows key then pressing the spacebar to activate the hotkey.
To try out this script, continue as follows: Save and close the file. Double-click the file to launch it. A new icon appears in the taskbar notification area.
Hold down the Windows key and press the spacebar. A web page opens in the default browser. To exit or edit the script, right-click the green "H" icon in the taskbar notification area. Each script can have multiple hotkeys and hotstrings.
To have a script launch automatically when you start your computer, create a shortcut in the Start Menu's Startup folder. Launching a program or document The Run command is used to launch a program, document, URL, or shortcut.
Here are some common examples: Run Notepad Run C: To have more than one command executed by a hotkey, put the first line beneath the hotkey definition and make the last line a return. By using it rather than something like C: The names of commands and variables are not case sensitive.
To have the script wait for the program or document to close before continuing, use RunWait instead of Run. In the following example, the MsgBox command will not execute until after the user closes Notepad: To learn more about launching programs -- such as passing parameters, specifying the working directory, and discovering a program's exit code -- click here.
Sending keystrokes and mouse clicks Keystrokes are sent to the active foremost window by using the Send command.WinGetText works on minimized windows, but only works on hidden windows if you've set AutoItSetOption("WinDetectHiddenText", 1) If multiple windows match the criteria for WinGetText, the information for the most recently active match is returned.
Please use this space to categorize answers, as there are over responses to this question and otherwise your answer will be lost. If better answers than what's listed have been provided, please remove or replace the answer links below. AutoHotkey Applications is neither a beginning tutorial nor an advanced technical manual.
It is an intermediate level guide to building useful applications with AutoHotkey. Many of the scripts discussed are quite simple and can be implemented by anyone with a basic understanding of AutoHotkey. ; The following example retrieves the TYPE of a registry value (e.g.
REG_SZ or REG_DWORD).
MsgBox % RegKeyType("HKCU", "Environment", "TEMP") return RegKeyType(RootKey, SubKey, ValueName) ; This function . Learn details about scripts in general, splitting long lines, compiling a script, passing command line parameters, codepage and debugging.
Within a registry loop, RegDelete and RegDeleteKey do not necessarily delete the current loop item. If the item is a subkey, RegDelete() only deletes its default value while RegDeleteKey() deletes the key itself.
If the item is a value, RegDeleteKey() deletes the key which contains that value, including all subkeys and values.