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.[6] The AutoHotkey installation includes a help file. Documentation is available on the internet.[7]

AutoHotkey logo.png
Developer(s)Chris Mallett, Steve Gray
Initial releaseNovember 10, 2003; 20 years ago (2003-11-10) (Chris Mallet)[1]
July 18, 2008; 16 years ago (2008-07-18) (Steve Gray)[2][3]
Stable release1.1.31.01 / October 14, 2019; 4 years ago (2019-10-14)[4]
Preview release2.0-a105 / September 22, 2019; 4 years ago (2019-09-22)[5]
Operating systemMicrosoft Windows
TypeScripting language Automation GUI utility
LicenseGPL
Websiteautohotkey.com

Features

AutoHotkey scripts can be used to load programs, open documents, and issue keystrokes and mouse clicks.[8]

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 Ctrl+Alt+I on the keyboard, a script could open a web browser.

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

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".[10]

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.[11]

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.[12]

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.[1] It was based on the syntax on AutoIt v2. It used some AutoIt v3 commands and the AutoIt v3 compiler.[13] AutoIt v3 changed its license from GPL to closed source because of "other projects repeatedly taking AutoIt code" and "setting themselves up as competitors."[14]

In 2010, AutoHotkey v1.1 (originally called AutoHotkey_L) became the platform for ongoing development of AutoHotkey.[15] In late 2012, it became the official branch.[16]

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 ⊞ Win+G will open the user's default web browser and perform the search.

<source lang="autohotkey">

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

</source>

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":

<source lang="autohotkey">

afaik::as far as I know

</source>

The example below makes Ctrl+⇧ Shift+Q replace selected text in an editor with a quoted version of that text. It illustrates the use of functions, arguments and default argument values. <syntaxhighlight lang="autohotkey"> ^+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 . """" } </syntaxhighlight>

User-contributed features

There are extensions/interops/inline script libraries available for usage with/from other programming languages:

Other major plugins enable support for:

Malware

Some malware has been written using AutoHotkey.[33]

Anti-malware products sometimes falsely identify AutoHotkey scripts as malware. These are called false positives.[34][35][36][37][38][39][40]

Related pages

References

  1. 1.0 1.1 "AutoHotkey Changelog for Years 2003-2004". Autohotkey.com. Archived from the original on 2011-11-04. Retrieved 2011-12-02.
  2. "Changes & New Features AutoHotkey (sorted by date)".
  3. "L4 Source Code (sorted by date)". GitHub.
  4. "AutoHotkey Downloads".
  5. "AutoHotkey v2 Downloads (sorted by date)".
  6. Contact Erica Sadun: Comment (2005-08-19). "Ericasadun 2005 Life Hacker". Lifehacker.com. Archived from the original on 2005-10-24. Retrieved 2011-12-02.
  7. "Quick Reference | AutoHotkey".
  8. "AutoHotkey Tutorial: Macro and Hotkey Creation". Autohotkey.com. Retrieved 2011-12-02.
  9. "Remapping Keys and Buttons". Autohotkey.com. Retrieved 2011-12-02.
  10. "Hotstrings and Auto-replace (similar to AutoText and AutoCorrect)". Autohotkey.com. 2005-01-09. Retrieved 2011-12-02.
  11. "Hotkeys, Hotstrings, and Remapping". Autohotkey.com. Retrieved 2018-05-23.
  12. "AutoHotkey Changes and New Features, v1.0.47 - June 19, 2007". Autohotkey.com. Retrieved 2011-12-02.
  13. "Author Chris Mallett's post on the AutoHotkey Forums". Autohotkey.com. Retrieved 2011-12-02.
  14. "Licensing Opinions - AutoIt Forums". Autoitscript.com. Retrieved 2011-12-02.
  15. "Forum post by Chris, announcing AutoHotkey_L now main platform". Autohotkey.com. Retrieved 2011-12-02.
  16. "The AutoHotkey Foundation : Our History". The AutoHotkey Foundation. 2014-05-26. Retrieved 2016-07-23.
  17. .NET Framework
  18. LibLua
  19. Lisp on win32
  20. Embeddable Common Lisp
  21. Windows Scripting Host
  22. Embedded machine code
  23. Function Hooks
  24. COM Wrappers
  25. Console Interaction (LibCon)
  26. Dynamic Code Generation
  27. Human Interface Device(HID) Support
  28. Internet Explorer Automation
  29. SmartGUI Creator
  30. Sparrow AHK Web Server
  31. Bit Wizardry
  32. Windows Event Hooks
  33. Research, Cybereason Nocturnus. Fauxpersky: CredStealer malware written in AutoHotKey masquerades as Kaspersky Antivirus, spreading through infecting USB drives. https://www.cybereason.com/blog/fauxpersky-credstealer-malware-autohotkey-kaspersky-antivirus. Retrieved 2018-03-29. 
  34. "trojan in autohotkey installer?". AutoHotkey Forums. gallaxhar.
  35. "False positive virus alert?". AutoHotkey Forums. narny.
  36. "False positive on antivirus programs". AutoHotkey Forums. Ferry.
  37. "Trojan.Antavmu detected in AutoHotKey". AutoHotkey Forums. apao.
  38. "Avast, false positive exe files". AutoHotkey Forums. Doron.
  39. "False Positive: Malwarebytes Anti-Malware PRO and Windows 8". AutoHotkey Forums. PuzzledGreatly.
  40. "Antivirus scan for AutoHotkey112400_Install.exe". VirusTotal.

Other websites