AutoHotkey

From Wikipedia, the free encyclopedia

AutoHotkey
Developer: Chris Mallett
Latest release: 1.0.46.07 / January 23, 2007
OS: Microsoft Windows
Use: Automation GUI utility
License: GPL
Website: http://www.autohotkey.com/

AutoHotkey is a free, open source macro and automation software which allows users to automate repetitive tasks and modify the Windows user interface. It is driven by a custom scripting language that is aimed specifically at providing keyboard shortcuts or hot keys, and is intended to be backwards compatible with the AutoIt2 language.

Many simple and repetitive tasks can be automated with this system. Scripts can launch a program or document, send keystrokes and mouse clicks, set and retrieve variables, run loops, and manipulate windows, files, and folders. A side effect of setting hotkeys is that keys can be remapped or disabled. AutoHotkey also allows 'hotstrings' to be replaced as they are typed (e.g. turning "btw" into "by the way").

More complex tasks can be achieved with custom data entry forms (GUIs), working with the registry, or using the Windows own API by calling the DLLs. The scripts can be compiled to an executable file that can be run on computers that don't have AutoHotkey installed.

A list of other tasks AutoHotkey could be used for:

  • to be able to use handy shortcuts for often used folder names
  • to more easily search for movies on the Internet Movie Database
  • to move around windows on the desktop with the keyboard only
  • to move around windows with the mouse that you normally can't move at all
  • to use shortcuts for often used and complex URLs
  • to open URLs from the clipboard in less than a second
  • to easily use different signatures in emails or add info to the signature
  • to close a program window that needs to be sitting in AutoStart but won't close itself when it's done
  • to automatically backup important files at regular intervals
  • to remap keys, game controller buttons, and mouse buttons
  • to make Ctrl-TAB work in tabbed programs that don't support Ctrl-TAB by themselves
  • to use your game controller as a mouse or keyboard and vice versa
  • to handle text processing and reformatting tasks, via its string handling functions and support for regular expressions

[edit] Examples

The following scripts allow the user to search for a particular word or phrase using Google or Wikipedia. After selecting the text from any application, pressing the configurable hotkey will open the default browser and perform the search.

Hotkey is Win + g
#g::
  Send, ^c
  Run, http://www.google.com/search?q=%Clipboard%
Return
Hotkey is Win + w
#w::
  Send, ^c
  Run, http://en.wikipedia.org/wiki/Special:Search?search=%Clipboard%
Return

AutoHotkey is often used to automate typing. For example the following script allows a Wikipedian using Firefox to right click on a user name or IP link and copy its value into variables with the hotkeys CTRL-SHIFT-W and CTRL-SHIFT-E. Then with the hotkey CTRL-SHIFT-R, the program uses the variables to produce an edit summary.

^+w::last := CopyUser( )
^+e::edit := CopyUser( )

CopyUser( )
{
   Clipboard =
   Send, ^c
   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
}

^+r::Send revert edits by [[Special:Contributions/%edit%|%edit%]] to last version by %last%

There are many more examples of what can be done with autohotkey in the scripts and functions section of their forum. Many of these scripts have also have been sorted into a catalogue based on the purpose of the script.

[edit] See also

[edit] External links

In other languages