ComputorEdge

Get these free e-books for more handy beginner tips: Why AutoHotkey? and AutoHotkey Tricks You Ought to Do with Windows!

Introduction to AutoHotkey:
A Review and Guide for Beginners

by Jack Dunning

Is AutoHotkey Right for You?

Maybe someone mentioned AutoHotkey or you came across it while surfing the Web. The name AutoHotkey doesn't say much about what the scripting language 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 that doesn't help all that much?

The purpose of this article is to provide insight into the free AutoHotkey Windows utility for people who know little or nothing about it and give some awareness about how to use it. After reading this page, you can determine for yourself if AutoHotkey warrants further investigation or something you should avoid.


Some people may find terms such as scriptwriting and programming intimidating. Don't let this dissuade you from further investigation. I assure you that AutoHotkey provides one of the gentlest introductions into the world of Wiindows scripting. if you can turn on a Windows computer and write an e-mail (or any other text document), then you can use and benefit from AutoHotkey. Yes, you can write simple, but quite useful, AutoHotkey scripts without any programming knowledge. (You will find some easy, one-line examples on this page which will make your Windows computing life easier immediately.)

First, the features of AutoHotkey:

  1. It works only on Windows computers but works everywhere in Windows.
  2. You get the basic software (and most AutoHotkey applications) free.
  3. As a scripting language for automating Windows, you only need to learn a tiny amount of programming.
  4. You can do either simple one-line apps or complicated tasks with AutoHotkey scripting—your choice.
  5. You'll find many ready-made applications available on the Web—most requiring no programming.
  6. If you want to learn a little programming, you'll find AutoHotkey the easiest start.
  7. AutoHotkey makes Windows computing easier.Jack's AutoHotkey Blog

Note: AutoHotkey is compatible with all current versions of Windows—from XP through Windows 10!

While this article only covers the most basic of AutoHotkey techniques, you'll find numerous interesting scripts available at the ComputorEdge Free AutoHotkey Scripts page and explained in the books listed on this page.

What You Can Do with AutoHotkey

AutoHotkey offers a powerful scripting language which can solve many complex problems, but the average novice can start with simple but useful scripts. Unlike most other software environments, you don't need to know very much about AutoHotkey to make excellent use of it.

Starting with the easiest applications, the following list provides a possible guide to your AutoHotkey journey. It starts with some simple tricks, then builds step-by-step toward slightly more complex scripts. Rather than jumping into one of the more mysterious—though powerful—apps, follow this list to learn AutoHotkey a teaspoon at a time:

  1. Write simple one-line Hotstrings for instant text replacement in any document of editing field on your computer or one the Web. Great for text auto-correct programs .
  2. Write simple Hotkeys for automating all of your Windows task. Launch programs, load Web pages, play music, or any one of many more applications (dim your screen, control volume with your mouse scrollwheel, make any window always-on-top, etc).
  3. Build pop-up windows for almost any purpose (an eggtimer, a to-do list, add dates to documents, etc).
  4. Build menus for instant access to all of your favor apps (e.g. QuickLinks to replace the awkward Start menu, a menu of active windows,  a menu of synonyms).
  5. Write more advance scripts that read and write files, search Windows File Explorer, or access the Windows Registry.
  6. Produce that killer app—answering the question "Life, the Universe, and Everything?"
While AutoHotkey can provide immediate satisfaction of many of your Windows computing needs, you'll find the language quite capable of producing much more powerful scripts capable of competing with any  commercial software package.

How to Get Started

If you have never programmed before, you should concentrate on the two most basic functions of AutoHotkey: Real-time text replacement (Hotstrings) and setting up shortcut key combinations which run programs or simple routines (Hotkeys) for automating your computer, visiting Web sites and speeding up operations on your other Windows programs.

Instant Text Replacement (HotStrings)

ComputorEdge AutoHotkey E-BooksWhile AutoHotkey offers too many features to enumerate, two key aspects of the language reflect both the name AutoHotkey and the most basic purpose of the free Windows scripting language. First, a Hotstring preforms simple replacement of text while you type on your keyboard. For example, if I write a one-line script containing the line:

::j@::jackdunning@gmail.com

then save that line in a text file with the AHK extension (i.e. myemail.ahk), I can run that script with the installed AutoHotkey program creating one Hotstring. Whenever I type “j@” and hit the space bar, period or comma, the full address (jackdunning@gmail.com) replaces those two characters. This happens everywhere on my Windows computer, whether I use Microsoft Word, Outlook Express, a Blog on the Web, Notepad, or any other text editing field. You can immediately see the value for this line of code. Plus, AutoHotkey does not limited you to just one line of code.

An AutoHotkey script can contain a series of lines similar to the one above, each creating a instant text replacement combination—saving you time—plus the wear and tear on your fingers. In one case, thousands of such code lines make up the AutoCorrect.ahk script—monitoring your work in real-time with a list of the most commonly misspelled words in the English language.

Powerful Hotkeys

Beginning AutoHotkey Hotstrings 200px

The second basic feature of AutoHotkey, Hotkey creation, sets up shortcut key combinations for runniing your favorite programs, visiting your favorite Web pages, speeding up tasks within other Windows programs, or running much more complex AutoHotkey scripts. For example, suppose you wanted to quickly load your Web browser with a particular site.

#space::Run http://www.computoredge.com/
Save that one line of code in a text file using the .ahk extension with Notepad (i.e. openwepage.ahk could be the name of the file), then, with AutoHotkey installed, run it with a double-click on the filename in Windows File Explorer. Now, after pressing the space bar while holding down Windows key (), the default browser opens—navigating to the ComputorEdge main Web page. The # sign represents the Windows key ()—the character used to designate that key in an AutoHotkey combination.

Another example of a Hotkey line of code:

^!c::Run calc.exe
This one uses the Control+Alt+C Hotkey combination to open the Windows Calculator. (^ represents Control and the exclamation point ! represents Alt in the Hotkey combination.)

AutoHotkey uses the double-colon (::) to designate Hotstring text replacement and Hotkey combinations. In text replacement, the double-colon appears at the beginning of the line—assigning the activating character string (when pressed in order). The second double-colon designates the replacement text for the activation string.

When setting up a Hotkey combination (keys pressed simultaneously), the activating characters appear at the beginning of the line—followed by the double colon. The command (or set of commands) following the double-colon determines the actions executed after pressing the Hotkey combination.

The following image shows four different Hotkeys/Hotstring setups (three Hotkeys and one Hotstring):



This image shows an example of an AutoHotkey script in Notepad which sets up different independent routines. The four sets of code added to the script perform the following functions:
  1. Open a Google search in the default Web browser.
  2. Launch Windows Notepad and return a message when you close it,
  3. Launch the Windows Calculator.
  4. Convert "imho" to "in my humble opinion" anywhere you typed it.
(AutoHotkey automatically adds the text at the top of the file]when you create a new AutoHotkey file.)

You'll find it easy to get started with AutoHotkey. Install the AutoHotkey program which runs in the background (see the AutoHotkey Web page) and write the examples above and save then a simple text file with the .ahk extension. While AutoHotkey can get much more complex, when starting out, you only need the basics. You can get yourself up and running in a very short time. If you want more, then you'll find plenty of help available.

Jack regularly writes AutoHotkey on all ranges of topics blogs at " Jack's AutoHotkey Blog."

And So Much More

Hotstrings and Hotkeys only scratch the surface of what AutoHotkey can do for your Windows computer. The AutoHotkey scripting language offers the simplicity to build simple pop-up apps, build useful menus, and solve numerous routine Windows problems while providing the power for much more complex programs. Over the course of the 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 makes 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:

• Adding dates to any documents (AddDate)

• Instant correction of commonly misspelled English words (AutoCorrect)

• Quick backup of text (BackupText and IncrementalSaveText)

• Calculating ages (GrandKids)

• Opening hard to find or often used folders (FolderOpen)

• Setting up temporary hotkey combinations to add text to documents (InstantHotkey)

• Tailored Start pop-up windows and menus as a replacement for the missing Start Menu in Windows 8 or any other version of Windows (LaunchWindow and QuickLinks)

• A barebones Windows media player for music and video (QuikPlay)

• A reminder app that pops-up for appointments (Reminder)

• A voice app that reads text to you (SayWhat)

• An app for moving and sizing options for the last active window (WindowMove)

• An app for looking up the geographic location of any highlighted IP address on the Web (IPFind)

• And more!

I have posted these scripts at the ComputorEdge Free AutoHotkey Scripts page download site.

Why Use AutoHotkey?

Many programs such as Microsoft Word includes features similar to those available through AutoHotkey. You can do text replacement with a set of commonly misspelled words plus create keyboard shortcuts (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 a 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 used 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 a 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. Some very dedicated individuals 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:

Get this e-book for a useful overview, AutoHotkey Tricks You Ought to Do with Windows! Also available at Amazon.com!

*                    *                    *

Beginner's GuideNow 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, Windows 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 command to the official AutoHotkey Web site.)

Also available at Amazon.com for the Kindle and Kindle software.

*                    *                    *

Digging DeeperJack's second AutoHotkey book which is comprised of updated, reorganized and indexed chapters from many of his sample applications are 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."

Also available at Amazon.com for the Kindle and Kindle software.

To get more detailed information about AutoHotkey and see a List of AutoHotkey commands visit the AutoHotkey Web site.

*                    *                    *

AutoHotkey ApplicationsJack'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!

*                    *                    *

AutoHotkey RegExThis 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)

Some More AutoHotkey Uses

AutoHotkey is a scripting language which can make almost everything easier on Windows computers. It can be a simple one-line script in a text file which enters your e-mail address after only typing a couple of characters (i.e. "m@" when typed becomes "myemailaddress@mymailserver.com"). There are some power apps which can make your computer life much easier. For example:

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).

ComputorEdge