AutoHotkey

AutoHotkey is a free, open-source scripting language for Microsoft Windows. It allows users to create keyboard shortcuts or hotkeys, fast macro-creation and software automation. It allows users to automate repetitive tasks in any Windows application. User interfaces can be extended or modified by AutoHotkey. For example, replacing the Windows control key commands with their Emacs equivalents. The AutoHotkey installation includes a help file. Documentation is available on the internet.

Features
AutoHotkey scripts can be used to load programs, open documents, and issue keypresses and mouse clicks.

AutoHotkey scripts can also change variables and manipulate windows, files, and folders.

AutoHotkey scripts can be started by a hotkey. When the user presses a combination of keys, such as  on the keyboard, a script could open a web browser.

Keyboard keys can be remapped, such that pressing  might result in the active window receiving an en dash (–). The same keys could be disabled, such that pressing  might result in nothing happening at all.

AutoHotkey also allows for 'hotstrings' that will automatically replace certain text as it is typed. A typical use for hotstrings is expanding abbreviations. Typing "btw" could be made to produce the text "by the way".

Scripts can be started automatically when the computer starts. These could run in the background and could be used to write information to a logfile.

More complex tasks can be making custom data entry forms (GUI windows), working with the system registry, or using the Windows API by calling functions from DLLs. The scripts can be compiled into an executable file that can be run on other computers that do not have AutoHotkey installed.

The source code is in C++ and can be compiled with Visual Studio Express.

Memory access through pointers is allowed just as in C.

Some uses for AutoHotkey:
 Remapping the keyboard, such as from QWERTY to Dvorak or other alternative keyboard layouts.
 Using shortcuts to fill in frequently-used file names or other phrases.
 Typing punctuation not provided on the keyboard, such as curved quotes (“…”).
 Controlling the mouse cursor with a keyboard or joystick.
 Opening programs, documents, and websites with simple keystrokes.
 Adding a signature to e-mail or message boards.
 Monitoring a system and automatically closing unwanted programs.
 Scheduling an automatic reminder, system scan, or backup.
 Automating repetitive tasks.
 Filling out contest and freebie forms automatically (it could type in your name, address, and so on, automatically).
 Prototyping before implementing in another, more time consuming, programming language.

History
The first public beta of AutoHotkey was released on November 10, 2003. It was  based on the syntax on AutoIt v2. It used some AutoIt v3 commands and the AutoIt v3 compiler. AutoIt v3 changed its license from GPL to closed source because of "other projects repeatedly taking AutoIt code" and "setting themselves up as competitors."

In 2010, AutoHotkey v1.1 (originally called AutoHotkey_L) became the main version for development. In late 2012, it became the official branch.

An alternative to the main program is AutoHotkey_H.

Version 2

On December 20, 2022, version 2.0.0 was released. On January 22, 2023, AutoHotkey v2 became the main version.

Examples
The following script will allow a user to search for a particular word or phrase using Google. After copying text from any application to the clipboard, pressing the configurable hotkey  will open the user's default web browser and perform the search.

#g::Run http://www.google.com/search?q=%clipboard%

The following script defines a hotstring that enables the user to type "afaik" in any program and have it automatically replaced with "as far as I know":

::afaik::as far as I know

The example below makes  replace selected text in an editor with a quoted version of that text. It illustrates the use of functions, arguments and default argument values. ^+q::QuoteSelection()  ; Ctrl+Shift+Q

QuoteSelection()
{
	selection := GetSelection()  ; Get selected text.
	PasteText(Quote(selection))  ; Quote the text and paste it back.
}

GetSelection(timeoutSeconds := 0.5)
{
	Clipboard := ""  ; Clear clipboard for ClipWait to function.
	Send ^c  ; Send Ctrl+C to get selection on clipboard.
	ClipWait %timeoutSeconds% ; Wait for the copied text to arrive at the clipboard.
	return Clipboard
}

PasteText(s)
{
	Clipboard := s  ; Put the text on the clipboard.
	Send ^v  ; Paste the text with Ctrl+V.
}

Quote(s)
{
	return """" . s . """"
}

User-contributed features
There are extensions/interops/inline script libraries available for usage with/from other programming languages:
 VB/C# (.NET).NET Framework
 LuaLibLua
 LispLisp on win32
 ECLEmbeddable Common Lisp
 VBScript/JScript (Windows Scripting Host)Windows Scripting Host
 Embedded machine codeEmbedded machine code

Other major plugins enable support for:
 Aspect-oriented programming
 Function hooksFunction Hooks
 COM wrappersCOM Wrappers
 Console interactionConsole Interaction (LibCon)
 Dynamic code generationDynamic Code Generation
 HIDsHuman Interface Device(HID) Support
Internet Explorer automationInternet Explorer Automation
GUI creationSmartGUI Creator
Web servicesSparrow AHK Web Server
 Synthetic programmingBit Wizardry
 Windows event hooksWindows Event Hooks

Malware
Some malware has been written using AutoHotkey.

Anti-malware products sometimes falsely identify AutoHotkey scripts as malware. These are called false positives.

Related pages
 AutoIt (for Windows)
 KiXtart (for Windows)
 Winbatch (for Windows)
 Macro Express (for Windows)
 Bookmarklet (for web browsers)
 iMacros (for Firefox, Chrome, and Internet Explorer)
 AutoKey (for Linux)
 Automator (for Macintosh)
 Keyboard Maestro (for Macintosh)

References

Other websites

AutoHotkey Foundation LLC

Category:Microsoft Windows software
Category:Programming languages