AutoHotkey
Encyclopedia
AutoHotkey is a free
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

, open source
Open-source software
Open-source software is computer software that is available in source code form: the source code and certain other rights normally reserved for copyright holders are provided under a software license that permits users to study, change, improve and at times also to distribute the software.Open...

 macro-creation and automation
Automation
Automation is the use of control systems and information technologies to reduce the need for human work in the production of goods and services. In the scope of industrialization, automation is a step beyond mechanization...

 software utility which allows users to automate repetitive tasks. Any application user interface can be modified by AutoHotkey (for example, with Emacs
Emacs
Emacs is a class of text editors, usually characterized by their extensibility. GNU Emacs has over 1,000 commands. It also allows the user to combine these commands into macros to automate work.Development began in the mid-1970s and continues actively...

 style). It is driven by a custom scripting language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 that is aimed specifically at providing keyboard shortcut
Keyboard shortcut
In computing, a keyboard shortcut is a finite set of one or more keys that invoke a software or operating system operation when triggered by the user. A meaning of term "keyboard shortcut" can vary depending on software manufacturer...

s or hotkeys.

Features

AutoHotkey scripts can be used to launch programs
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

, open documents, send keystrokes and send mouse
Mouse (computing)
In computing, a mouse is a pointing device that functions by detecting two-dimensional motion relative to its supporting surface. Physically, a mouse consists of an object held under one of the user's hands, with one or more buttons...

 clicks and movements. AutoHotkey scripts can also assign, retrieve, and manipulate variables
Variable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...

, run loops and manipulate windows
Window (computing)
In computing, a window is a visual area containing some kind of user interface. It usually has a rectangular shape that can overlap with the area of other windows...

, files
Computer file
A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished...

, and folders
Directory (file systems)
In computing, a folder, directory, catalog, or drawer, is a virtual container originally derived from an earlier Object-oriented programming concept by the same name within a digital file system, in which groups of computer files and other folders can be kept and organized.A typical file system may...

. These commands can be triggered by a hotkey
Keyboard shortcut
In computing, a keyboard shortcut is a finite set of one or more keys that invoke a software or operating system operation when triggered by the user. A meaning of term "keyboard shortcut" can vary depending on software manufacturer...

, such as a script that would open an internet
Internet
The Internet is a global system of interconnected computer networks that use the standard Internet protocol suite to serve billions of users worldwide...

 browser
Web browser
A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web. An information resource is identified by a Uniform Resource Identifier and may be a web page, image, video, or other piece of content...

 whenever the user
User (computing)
A user is an agent, either a human agent or software agent, who uses a computer or network service. A user often has a user account and is identified by a username , screen name , nickname , or handle, which is derived from the identical Citizen's Band radio term.Users are...

 presses Ctrl+Alt+i on the keyboard. Keyboard keys can also be remapped or disabled, such that pressing the letter q, for example, might result in the computer
Computer
A computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations. The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem...

 receiving a letter r, or nothing at all. AutoHotkey also allows for 'hotstrings' that will automatically replace certain text as it is typed; the most typical use for hotstrings is expanding abbreviations, such as assigning the string "btw" to send the text "by the way" when typed, or the text "%o" to send "percentage of".

More complex tasks can be achieved with custom data entry forms (GUI windows
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...

), working with the system registry
Windows registry
The Windows Registry is a hierarchical database that stores configuration settings and options on Microsoft Windows operating systems. It contains settings for low-level operating system components as well as the applications running on the platform: the kernel, device drivers, services, SAM, user...

, or using a window's own API
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

 by manipulating certain DLLs
Dynamic-link library
Dynamic-link library , or DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems...

. The scripts can be compiled
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

 into an executable
Executable
In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...

 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
Microsoft Visual Studio Express
Microsoft Visual Studio Express is a set of freeware integrated development environments developed by Microsoft that are lightweight versions of the Microsoft Visual Studio product line. Express Editions were conceived beginning with Visual Studio 2005...

.

Memory access through pointers is allowed just as in C.

Common AutoHotkey tasks:
  • Remapping the keyboard, such as from QWERTY
    QWERTY
    QWERTY is the most common modern-day keyboard layout. The name comes from the first six letters appearing in the topleft letter row of the keyboard, read left to right: Q-W-E-R-T-Y. The QWERTY design is based on a layout created for the Sholes and Glidden typewriter and sold to Remington in the...

     to Dvorak
    Dvorak Simplified Keyboard
    The Dvorak Simplified Keyboard is a keyboard layout patented in 1936 by Dr. August Dvorak and his brother-in-law, Dr. William Dealey. Over the years several slight variations were designed by the team led by Dvorak or by ANSI...

     or other alternative keyboard layouts.
  • Using shortcuts to fill in frequently-used filenames or other phrases.
  • Controlling the mouse cursor with a keyboard or joystick
    Joystick
    A joystick is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. Joysticks, also known as 'control columns', are the principal control in the cockpit of many civilian and military aircraft, either as a center stick or...

    .
  • Opening programs, documents, and websites with simple keystrokes.
  • Adding a signature
    Signature
    A signature is a handwritten depiction of someone's name, nickname, or even a simple "X" that a person writes on documents as a proof of identity and intent. The writer of a signature is a signatory. Similar to a handwritten signature, a signature work describes the work as readily identifying...

     to e-mail
    E-mail
    Electronic mail, commonly known as email or e-mail, is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer networks. Some early email systems required that the author and the recipient both be online at the...

    , message boards
    Internet forum
    An Internet forum, or message board, is an online discussion site where people can hold conversations in the form of posted messages. They differ from chat rooms in that messages are at least temporarily archived...

    , etc.
  • Monitoring a system and automatically closing unwanted programs.
  • Scheduling an automatic reminder
    Reminder software
    Reminder software is a type of time management computer software that is designed to alert the user of important events that they have input to the program. Most programs provide a calendar and/or list view of events, as well as a reminding technique...

    , system scan, or backup
    Backup
    In information technology, a backup or the process of backing up is making copies of data which may be used to restore the original after a data loss event. The verb form is back up in two words, whereas the noun is backup....

    .
  • Automating repetitive tasks in online games (often in violation of said games' terms of service)
  • Filling out contest and freebie forms automatically(i.e., it can type in your name, address, etc. automatically)
  • Quick code testing before implementing in another (more time consuming) programming language.

History

The first public beta of AutoHotkey was released on November 10, 2003 after author Chris Mallett's proposal to integrate hotkey support into AutoIt
AutoIt
AutoIt is a freeware automation language for Microsoft Windows. In its earliest release, the software was primarily intended to create automation scripts for Microsoft Windows programs but has since grown to include enhancements in both programming language design and overall functionality.With...

 v2 failed to generate response from the AutoIt community. So the author began his own program from scratch basing the syntax on AutoIt v2 and using AutoIt v3 for some commands and the compiler. Later, AutoIt v3 switched from GPL to closed source because of "other projects repeatedly taking AutoIt code" and "setting themselves up as competitors."

AutoHotkey has even been used by doctors in the radiology world.

As of October 10, 2010, the author has stated that AutoHotkey_L has become the ongoing development of AutoHotkey and this has been placed in the download section on the website.

Programmers within the AutoHotkey community have also begun development on their own versions/ports of the program:
  • AutoHotkey_L – now the main development branch
  • AutoHotkeyUUnicode
    Unicode
    Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

     version, merged into AutoHotkey_L
  • AutoHotkey.dll – DLL version of AutoHotkey
  • AutoHotkey for PocketPC – WinCE
  • AHKLinux – Linux/Wine
    Wine (software)
    Wine is a free software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems. Wine also provides a software library, known as Winelib, against which developers can compile Windows applications to help port them to Unix-like...

  • IronAHK – .NET/Mono
    Mono (software)
    Mono, pronounced , is a free and open source project led by Xamarin to create an Ecma standard compliant .NET-compatible set of tools including, among others, a C# compiler and a Common Language Runtime....

     version for Windows/Linux/Macintosh

Examples

This script swaps control and alt keys.


^q::WinClose A
F1::#d
^F4::WinClose A
LCtrl::Alt
LAlt::Ctrl
Launch_Mail::Suspend

The following script will allow a user to search for a particular word or phrase using Google
Google
Google Inc. is an American multinational public corporation invested in Internet search, cloud computing, and advertising technologies. Google hosts and develops a number of Internet-based services and products, and generates profit primarily from advertising through its AdWords program...

. After copying text from any application to the Clipboard, pressing the configurable hotkey Win
Windows key
The Windows logo key—also known as the Windows key, the home key, the meta key, the start key, MOD4, or the flag key —is a keyboard key which was originally introduced on the Microsoft Natural keyboard before the release of Windows 95. This key became a standard key on PC keyboards...

+g will open the user's default web browser
Web browser
A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web. An information resource is identified by a Uniform Resource Identifier and may be a web page, image, video, or other piece of content...

 and perform the search.


  1. g:: ; Win+g

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


The following is an example of the script required to create the hotstring "afaik," which is automatically replaced by "as far as I know":


afaik::as far as I know



The following is an example of a simple function in AutoHotkey. When a URL is copied to the Clipboard, the hotkey Alt+x will check the URL for any/all parenthesis and replace them with alternate characters before pasting the URL from the Clipboard:


!x:: ; Alt+x
URLReplace
Send ^v ; Ctrl+v
Return

URLReplace {
StringReplace, Clipboard, Clipboard, , `%29, All
}


In this example, once the contents of a user name or IP Address link have been copied from anywhere on Wikipedia's site to the Clipboard (using Firefox
Mozilla Firefox
Mozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. , Firefox is the second most widely used browser, with approximately 25% of worldwide usage share of web browsers...

), the following script allows a user to perform the function CopyUser on the Clipboard's contents and save it to a variable designated by either the hotkey Ctrl+Shift+W or the hotkey Ctrl+Shift+E. The hotkey Ctrl+Shift+R utilizes the resultant variables to produce a revert edits summary.


^+w::last := CopyUser ; Ctrl+Shift+w
^+e::edit := CopyUser ; Ctrl+Shift+e

CopyUser {
Clipboard =
StringReplace, Clipboard, Clipboard, http://en.wikipedia.org/
StringReplace, Clipboard, Clipboard, wiki/
StringReplace, Clipboard, Clipboard, w/index.php?title=
StringReplace, Clipboard, Clipboard, Special:Contributions&target=
StringReplace, Clipboard, Clipboard, User:
StringReplace, Clipboard, Clipboard, &action=edit
StringReplace, Clipboard, Clipboard, _, %A_Space%, All
Return, Clipboard
}

Ctrl+Shift+r
^+r::Send revert edits by %edit% to last version by %last%


More examples of what can be done with AutoHotkey can be found in the Scripts and Functions section of AutoHotkey's online forum. Many of these scripts have also have been placed into an AutoHotkey wiki based on the purpose of the script.

Community

The online community forum for AutoHotkey has around 20,250 registered users and around 372,000 posts as of October 2010.

The online chat room for AutoHotkey is located on Freenode
Freenode
freenode, formerly known as Open Projects Network, is an IRC network used to discuss peer-directed projects. Their servers are all accessible from the domain name [irc://chat.freenode.net chat.freenode.net], which load balances connections by using the actual servers in rotation...

 IRC
Internet Relay Chat
Internet Relay Chat is a protocol for real-time Internet text messaging or synchronous conferencing. It is mainly designed for group communication in discussion forums, called channels, but also allows one-to-one communication via private message as well as chat and data transfer, including file...

 with an average of 40 connected users as of November 2009.

User Contributed Features

The following extensions/interops/inline script libraries for usage with/from other programming languages are available or in development:
  • .NET FrameworkVB
    Visual Basic .NET
    Visual Basic .NET , is an object-oriented computer programming language that can be viewed as an evolution of the classic Visual Basic , which is implemented on the .NET Framework...

    /C# (.NET)
  • LibLua – Lua
  • Lisp on win32 – Lisp
  • Embeddable Common LispECL
    Embeddable Common Lisp
    Embeddable Common Lisp is a LGPL Common Lisp implementation aimed at producing a small-footprint Lisp system that can be embedded into existing C-based applications...

  • Windows Scripting HostVBScript
    VBScript
    VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...

    /JScript
    JScript
    JScript is a scripting language based on the ECMAScript standard that is used in Microsoft's Internet Explorer.JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages,...

  • Embedded machine codeMachine code
    Machine code
    Machine code or machine language is a system of impartible instructions executed directly by a computer's central processing unit. Each instruction performs a very specific task, typically either an operation on a unit of data Machine code or machine language is a system of impartible instructions...



Other:
  • Aspect Oriented Programming
    Aspect-oriented programming
    In computing, aspect-oriented programming is a programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns...

  • COM WrappersCOM
    Component Object Model
    Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

  • Dynamic Code Generation
  • Human Interface Device(HID) SupportHID
    Human interface device
    A human interface device or HID is a type of computer device that interacts directly with, and most often takes input from, humans and may deliver output to humans. The term "HID" most commonly refers to the USB-HID specification. The term was coined by Mike Van Flandern of Microsoft when he...

  • Internet Explorer Automation
  • SmartGUI Creator
  • Sparrow AHK Web Server
  • Synthetic programming
    Synthetic programming
    Synthetic programming refers to assembly language programming in scripting languages. Implementations vary from inline assembly to better wrapped machine instructions.-Implementations:* Python: Corepy: http://www.corepy.org/...

  • Windows Event Hooks

See also

  • AutoIt
    AutoIt
    AutoIt is a freeware automation language for Microsoft Windows. In its earliest release, the software was primarily intended to create automation scripts for Microsoft Windows programs but has since grown to include enhancements in both programming language design and overall functionality.With...

  • AutoKey
    Autokey
    AutoKey is a text expansion/replacement utility for Linux and X11. It is heavily inspired by the commercial Windows software 'PhraseExpress'. It receives keyboard events using one of several methods and uses X events to drive the expansions. AutoKey can be used to replace abbreviations with full...

     (for Linux)
  • Automator
    Automator (software)
    Automator is an application developed by Apple for Mac OS X that implements point-and-click creation of workflows for automating repetitive tasks into batches for quicker alteration, thus saving time and effort over human intervention to manually change each file separately...

     (for Macintosh)
  • Bookmarklet
    Bookmarklet
    A bookmarklet is Unobtrusive JavaScript stored as the URL of a bookmark in a web browser or as a hyperlink on a web page. The term is a portmanteau of the terms bookmark and applet, however, an applet is not to be confused with a bookmarklet just as JavaScript is not to be confused with Java...

  • Gui4Cli
  • iMacros for Firefox
    IMacros
    iMacros is an extension for the Mozilla Firefox, Google Chrome, and Internet Explorer web browsers which adds record and replay functionality similar to that found in web testing and form filler software. The macros can be combined and controlled via JavaScript. Demo macros and JavaScript code...

  • Texter 0.6
  • Typinator
  • TextExpander
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK