How-To: Create Custom Windows Shortcuts with AutoHotkey


Think about all the time you spend in front on your PC. Are you being efficient? Here’s a better question: Are you being as efficient as you can be? The simple answer is ‘No.’ Every time you lift your fingers off your keyboard to navigate Windows, you’re wasting time. Sure, it only takes a few seconds to drag your mouse cursor over to the Firefox icon or to navigate the Start menu to open up the Control Panel, and while none of that sounds like a big deal, it all adds up over time, be it a week, a month, or a year. The reason Microsoft includes so many shortcuts in Windows is so you can streamline these little time wasters, but these preset hotkeys will only take you so far.

That’s where AutoHotkey comes in, a lightweight but powerful app that allows you to create keyboard shortcuts for any Windows program. Here are a few tricks to get you started.

What You’ll Need

•    A PC running Windows 95 or later
•    Any keyboard (USB or PS/2)
•    USB Flash drive (optional, for portability)
•    About 15 minutes

Installation and Setup

You can grab AutoHotkey from . There’s not much to the initial installation, so go ahead and leave the default options alone. When you fire it up for the first time, you’re given the option of creating a sample script in the My Documents folder. This isn’t necessary, but it is a good way to familiarize yourself with the basic instructions. In short, the way this works is by creating scripts, which consists of a plain text file containing commands that AutoHotkey.exe will execute.

Once installed, create a folder called AutoHotkey Scripts on your Desktop or any other place where you want to store your scripts. If you don’t want to clutter your desktop, creating the folder on the root of your C:\ drive will keep the folder out of sight, but still easy to find.

Example: Auto-Launch Firefox

We’re going to create a script that allows us to call up Mozilla’s Firefox browser without ever taking our hands off the keyboard. Keep in mind that while we’re focusing on Firefox in this example, you can adjust the code for any program you want.

Open up the scripts folder you just created, right-click anywhere in the empty space, and select New. One of the options in the context menu should now read AutoHotkey Script, and as you’ve probably guessed by now, this is what you’ll select. Name the script Firefox, and then right-click it and select Edit Script.

We could dedicate an entire issue to scripting languages, however you don’t need to be a programming guru to follow along. For this one, all you have to do is type ^#f::Run C:\Program Files (x86)\Mozilla Firefox\firefox.exe . Confused? Let’s break this down. The first part of the code tells AutoHotkey which key combination to use, followed by the Run command, and finally the location of the program we want to run. In this case, we just coded a script to open up Firefox when pressing Control (^), Windows Key (#), and the f key.

You can change the key combination to whatever you want. When you’re finished, save your work, close the Window, and then double-click the .ahk file you just edited (Firefox.ahk, in our example). Now the script is loaded and ready to use!

Transform Shorthand into Longhand with Hotstring

In addition to hotkeys, AutoHotkey also makes use of hotstrings, which allows you to bind keystrokes to words or phrases. This comes in especially handy when composing emails, whether it’s typing out an email address or converting your text-speak shortcuts into legible English.

Create and edit a new script as previously outlined. We’re going to enclose our shorthand text between pairs of colons followed by the unabbreviated text we want to replace it with. For example, to create a two-letter abbreviation for To Whom It May Concern using the letters ‘tw,’ we would type ::tw::To Whom It May Concern . This trick also comes in handy for email addresses. Create as many abbreviations as you see fit (use a new line for each), save and exit, and then double-click the .ahk file as before. Your abbreviations will be automatically replaced by the designated text whenever you hit the key combinations (in this case, tw) followed by a space, period, or enter.

Example: Create Your Own Media Controls

Don’t fret if your keyboard doesn’t include multimedia controls, because with AutoHotkey, it’s simple enough to create your own. Here’s an example of a script for controlling all facets of multimedia playback using the CTRL+Shift combination:

^+m::Send {Volume_Mute}
^+.::Send {Volume_Up}
^+,::Send {Volume_Down}
^+n::Send {Media_Next}
^+b::Send {Media_Prev}
^+o::Send {Media_Stop}
^+p::Send {Media__Play_Pause}

The coolest part about this is the above controls work with any media player, be it Windows Media Player, WinAmp, or even Napster.

Take Your Scripts with You

It isn’t necessary to install AutoHotkey on every PC you come in contact with. Instead, right-click on any scripts you want to make portable and select Compile Script. AutoHotkey will spit out a related executable that can be run on any Windows-based PC!

Around the web