Introduction to AutoHotkey: A Review and Guide for Beginners
Is AutoHotkey Right for You?
Maybe someone mentioned AutoHotkey to you or you came across it while surfing the Web. There is nothing obvious about the name AutoHotkey or what it does. Searches on AutoHotkey can generate many questions while answering only a few. Is AutoHotkey something that you want for your Windows computer or is it merely another free utility which doesn't help all that much?
The purpose to this article is to review the free AutoHotkey Windows utility for people who know little or nothing about it and give some insight on how it's used. By the time you reach the end of this page you should be able to determine if AutoHotkey is something which warrants further investigation or if it's not for you.
There are terms used in AutoHotkey such as script writing and programming which some people may find intimidating. Don't let this dissuade you from further investigation. I assure you that if you can turn on a Windows computer and write an e-mail or other text document, then you can use and benefit from AutoHotkey. And, yes, you can even write simple, but quite useful, AutoHotkey scripts without any programming knowledge. (You will find some easy, one-line examples on this page which might make your life easier immediately.)
It is true that AutoHotkey is a powerful scripting language which can solve many complex problems, but there is no need for the average novice to do any of that. Unlike most other software environments, you don't need to know very much about AutoHotkey to make powerful use of it. If later you decide that you want to learn more, fine—but at the start you want to concentrate on the two most basic functions of AutoHotkey: Real-time text replacement and setting up hotkey combinations which run programs, visit Web sites, and speed up operations in your other Windows programs.
compatible with all current versions of Windows—from XP to Windows 10!
While there are so many features in AutoHotkey that it's impossible to enumerate them all in one article, there are two functions which reflect both the name AutoHotkey and the most basic purposes of the free Windows scripting language. The first is simple replacement of text while you're typing on your keyboard. For example, if I write a one-line script containing the line:
then save that line in a text file with the AHK extension (i.e. myemail.ahk), I can run that script with the AutoHotkey program creating one hotkey combination. Every time I type “j@” and hit the space bar, period or comma, then the full address (email@example.com) will replace those two characters. This will happen everywhere on my Windows computer, whether I'm using Microsoft Word, Outlook Express, a Blog on the Web, Notepad, or any other text editing field. You can immediately see the use for this line of code. Plus, it is not limited to just one item.
An AutoHotkey script can be a series of lines similar to that above, each creating a shortcut key combination which can save you time plus wear and tear on your typing fingers. In one case, thousand of such lines are included for auto-correcting the most commonly misspelled words in the English language.
The second basic feature of AutoHotkey is the creation of hotkey combinations to run your favorite programs, visit your favorite Web sites, speed up functions within other Windows programs, or run much more complex AutoHotkey scripts. For example, suppose you wanted to quick load your Web browser and visit a particular site.
#space::Run http://www.computoredge.com/That one line of code which can be saved in a text file with Notepad using the AHK extension (i.e. openwepage.ahk could be the name of the file) will open the default browser and navigate to the ComputorEdge Web site after pressing the space bar while holding down Windows key (). The # sign is the character used to designated the Windows key () in an AutoHotkey combination.
Another example is this line of code:
^!c::Run calc.exewhich uses the CONTROL+ALT+C hotkey combination to open the Windows Calculator. (^ represents CONTROL and ! represents ALT in the hotkey combination.)
The double colon (::) is commonly used in AutoHotkey to designate text replacement and hotkey combinations. In text replacement the double colon is used at the beginning of a line to indicate the keys which will activate the replacement when pressed in order. The second double colon designates the text which will replace the first text. When a hotkey combination (keys pressed simultaneously) is setup, those characters begin the line, followed by the double colon. The command (or set of commands) which follow the double colon become the action executed when the hotkey combination is pressed.
Here is an example of an AutoHotkey script in Notepad which sets up different independent routines. Four sets of code have been added to the script to perform the following functions: 1. Open a Google search in the default Web browser; 2. Launch Windows Notepad and return a message when it is closed; 3. Launch the Windows Calculator; 4. Convert "imho" to "in my humble opinion" anywhere it is typed. (The text at the top of the file is automatically added when you create a new AutoHotkey file.)
It is that simple to get started with AutoHotkey. All you need is to install the AutoHotkey program which runs in background (see the AutoHotkey Web page) and the ability to write or save a simple text file. AutoHotkey can become much more complex, but if you only need the basics then you can be up and running in a very short time. If you want more, then there is plenty of help available.
Jack regularly writes beginning
AutoHotkey blogs at " Jack's
and HotKeys only scratch the surface of what AutoHotkey can do for your
Windows computer. AutoHotkey is a scripting language with the power to
build simple pop-up apps and solve numerous routine Windows
course of the last few years I've posted many beginning AutoHotkey scripts (free to
download and use) which accomplish a variety of different tasks. Some
are as simple as a one-liner which will make any window "always-on-top"
while others (although not complicated) involve time calculations for
the age of grandkids (or anyone) or a barebones music player. The
following are a few of the practical uses available for download:
Why Use AutoHotkey?
Many programs such as Microsoft Word has features similar to those offered by AutoHotkey. You can do text replacement with a set of commonly misspelled words plus create macros (hotkeys) for quickly executing regular tasks. However, those tools in Microsoft Word only work in Word and a couple of other Microsoft products. AutoHotkey works everywhere you use it whether in a Windows program or on the Web. It even works in Word. AutoHotkey gives you an universality that you won't see in most Windows utilities.
AutoHotkey is easy to set up and use. It has tremendous flexibility. There is a long list of AutoHotkey commands which can be use for everything from sizing and moving windows to adding calendar events to your Windows computers. But you don't need to use any of these commands to get great benefit from AutoHotkey.
AutoHotkey is free.
AutoHotkey is Open Source which means no one person or company owns it. There are no license fees and you are free to use your scripts anywhere you like. There are very dedicated individuals who maintain, update and support AutoHotkey. They can be found by visiting the AutoHotkey Forums.
If you are concerned about how safe AutoHotkey is, see this AutoHotkey Forum topic.
For More Information
If you're interested in testing AutoHotkey to see if it might be right for you, then go to "Installing AutoHotkey and Writing Your First Script." This page shows you how to get up and running with AutoHotkey, plus it offers links to other articles on how to use AutoHotkey.
To see more of the many possible applications for AutoHotkey check out "Free AutoHotkey Scripts and Apps for Learning."
If you want more information in either the Amazon Kindle format, EPUB format for use on the iPad and other types of tablet computers (or on your PC), or PDF for printing on notebook size paper, then check out the following e-books by Jack Dunning:
* * *Now available in e-book format, Jack's A Beginner's Guide to AutoHotkey, Absolutely the Best Free Windows Utility Software Ever!: Create Power Tools for Windows XP, Windows Vista, Windows 7, Window 8 and Windows 10.
Building Power Tools for Windows XP, Windows Vista, Windows 7 and Windows 8, AutoHotkey is the most powerful, flexible, free Windows utility software available. Anyone can instantly add more of the functions that they want in all of their Windows programs, whether installed on their computer or while working on the Web. AutoHotkey has a universality not found in any other Windows utility—free or paid.
Now in its third edition (December 2014), Jack takes you through his learning experience as he explores writing simple AutoHotkey scripts for adding repetitive text in any program or on the Web, running programs with special hotkeys or gadgets, manipulating the size and screen location of windows, making any window always-on-top, copying and moving files, and much more. Each chapter builds on the previous chapters. (The second edition now includes a chapter index of the AutoHotkey commands used in the book, plus Internet links directly to each commmand to the official AutoHotkey Web site.)
Also available at Amazon.com for the Kindle and Kindle software.
* * *
Jack's second AutoHotkey book which is comprised of updated, reorganized and indexed chapters from many of his sample applications is available at ComputorEdge E-Books. The book is organized and broken up into parts by topic. The book is not for the complete beginner since it builds on the information in A Beginner's Guide to AutoHotkey. However, if a person is reasonably computer literate, they could go directly to this book for ideas and techniques without the first book.
Jack shows how to build real world AutoHotkey applications. The AutoHotkey commands used are included in a special index to the chapters in which they appear. Even I can't remember everything I wrote."
* * *
Jack's third AutoHotkey book AutoHotkey Applications (preferred, EPUB format for iPad, Android, and computers; MOBI for Amazon Kindle; and PDF for printing) is an intermediate level book of ideas and applications based primarily on the AutoHotkey GUI command. The book emphasizes practical applications. The book is not for the complete beginner since it builds on the information in the other two books. However, if a person is reasonably computer literate, they could go directly to this book for ideas and techniques without the other books. There is an extensive index to the ideas and techniques covered in the back of the book. (Also available from Amazon for the Kindle and Kindle software on other devices.)
For an EPUB (iPad, NOOK, etc.) version of AutoHotkey Applications click here!
For a PDF version for printing on letter size paper for inclusion in a standard notebook of AutoHotkey Applications click here!
* * *
This Beginner's Guide to Using Regular Expressions in AutoHotkey is not a beginning level AutoHotkey book, but an introduction to using Regular Expressions in AutoHotkey (or most other programming languages). To get the most from this book you should already have a basic understanding of AutoHotkey (or another programming language). Regular Expressions (RegEx) are a powerful way to search and alter documents without the limitations of most of the standard matching functions. At first, the use of RegEx can be confusing and mysterious. This book clears up the confusion with easy analogies for understanding how RegEx works and examples of practical AutoHotkey applications. "Regular Expressions in AutoHotkey" will take you to the next level in AutoHotkey scripting while adding more flexibility and power to your Windows apps. (This book is also available at Amazon.com)
More AutoHotkey Uses
• Autocorrect over 5,000 commonly misspelled words in any Windows program or on the Web.
• Set a reminder for a later meeting.
• Use QuickLinks to replace the missing Windows 8 Start Menu (or just to make life easier in any version of Windows).