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 www.autohotkey.com. 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.
Comments
Comments are closed on this article
![]()
mechtheist
July 06, 2011 at 5:14am
If you use multiple PCs, put your .ahk's in your DropBox folder and put shortcuts to them in the startup folder. Helps with the sanity.
![]()
strobin
June 16, 2011 at 10:58pm
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.
[url=http://www.micrositez.us/seo]Seo Orlando[/url]
![]()
micheal12
April 15, 2011 at 2:33am
I just came across your blog and reading your beautiful words. I thought I would leave my first comment but I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. 3m tegaderm
![]()
micheal12
January 19, 2011 at 1:23pm
Auto Hot key also makes use of hot strings, 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. Thanks for sharing. Regards, Sex Toys
![]()
inter4522
December 15, 2010 at 8:33pm
Getting the hotkeys configures is always hard for me. I think this process is so eay to use. Having hotkeys configured makes things easier. Keep up the good work.
![]()
Greethn
December 09, 2010 at 4:19am
Would it be possible to create a hotkey to put your computer to sleep? My old keyboard had a button that would put the computer to sleep, but my new one does not. Sadly, it's a feature I really miss.
![]()
AshRo
September 05, 2010 at 11:25pm
This will indeed save a lot of time over months of work. Web Design cleveland Ohio
![]()
Cardboardboxer™
February 23, 2010 at 9:46pm
This is a great app for netbooks, and while I wouldn't say I could never figure out how to have it change songs, I would say you have saved me tons of time which is greatly appreciated. Thanks as always MPC.
![]()
jonahkirk
January 22, 2010 at 4:24pm
Great program, but what I really need is a way to program a hotkey into my WMC Remote so I can open Hulu Desktop on my HTPC with a button click instead of having to close out WMC and mouse accross my desktop to the shortcut. Any ideas?
![]()
RockyTopper
January 22, 2010 at 10:51am
Would it be possible to create a hotkey to put your computer to sleep? My old keyboard had a button that would put the computer to sleep, but my new one does not. Sadly, it's a feature I really miss.
FYI, I'm running windows 7 x64
![]()
Paul_Lilly
January 22, 2010 at 1:34pm
Yes, you can create a Sleep Hotkey in Win 7, it just takes a little bit of configuring. Here's how you do it:
![]()
First, go to this website and download the Sleep VBScript. Follow the site's instructions, which basically tells you to extract the folder to C:\Program Files.
![]()
For this to work smoothly, we need Windows to go into Sleep mode instead of shutting down when the power button is pressed. Open up the Start menu, right-click the Shutdown button, and select Properties. Select Sleep from the Power button action menu.
Now create a new script following the steps outlined in this article. In this example, we're going to make the PC go into sleep mode by pressing CTRL+Win+Enter. To do this, we'd type the following:
^#Enter::Run C:\Program Files\Sleep Shortcut\Sleep.vbs
Send {Enter}Save your changes, close it out, and then double-click the script to enable it.
When you run the Hotkey combo to put your PC to sleep, a pop-up Window will appear asking if you really want to run this type of file. That means an extra keystroke or mouse click, so if you want to eliminate this extra step, uncheck "Always ask before opening this type of file." From now on, Windows won't prompt you when going into sleep mode with your new Hotkey combo, but be advised you've just disabled any security check for running VBS files.
One other thing worth noting. For best results, you're going to want to use the Enter key when configuring your Hotkey shortcut. If you don't, you'll end up seeing the above prompt, which isn't a big deal since you can just press Enter, but again, it's an extra keystroke.
-Paul Lilly
![]()
GFC
January 22, 2010 at 3:27am
Very useful small app. I would just like a bit of help here. Would it be possible to somehow flip through pictures with just hotkeys (maybe while being in the game?)
If someone knows what kind of a command/string you need - I'd really appreciate the help.
Log in to MaximumPC directly or log in using Facebook
Forgot your username or password?
Click here for help.

















