There are some things that are just a pain to type—especially when you have to type them over and over and over. Or even worse, if they thing you want to type doesn’t exist on your keyboard. What do you do if you’re using an American keyboard and need to drop a € into a document?
I was having this problem. I was getting annoyed, and even worse, I was making mistakes. I needed to curb my annoyance and make sure these monotonous things I had to type repeatedly were consistent and correct. The hunt was on for solutions. Turns out there is one answer to both problems: AutoHotKey.
What Is AutoHotkey?
At its core, AutoHotkey (AHK) is a scripting platform. With just a tiny bit of “code,” you can create a script that runs in the background and allows you to do just about anything with a hotkey you set. If there’s a keyboard shortcut you want to change, you can remap it. If there is a phrase you type regularly, you can assign a key combination to it. If there are a series of commands you manually run on a regular basis, AHK can run them all with a simple key combo.
Don’t be scared by words like “scripting platform” and “code,” though. AutoHotkey is extremely simple to get started with, especially if you’re just assigning basic hotkeys to basic commands. Chances are, you can learn what you need to over the course of a single afternoon. Let’s go through some basic examples of what AutoHotkey can do to get you started.
How to Install AutoHotkey
Head to AutoHotkey’s website to download the program. On the main page is a big green button that says “Download” on it. Clicking on that will take you to the download page. Here you can on a teal download button to get the latest version.
NOTE: Some antivirus programs will flag AutoHotkey as malware. This is a false positive. AutoHotkey is extremely powerful, and while it isn’t dangerous on its own, it is a scripting language—which means you could create malware with it if you had the desire to. But don’t worry about downloading the base AutoHotkey program itself; it will not harm your computer.
Once the installation file has downloaded, double click on it to begin installing AutoHotkey. Nearly all users will want to use the Express Installation button. Custom installation gives you options around default behaviors and install location. Leaving the defaults in place is best.
Once it’s installed, you’re ready to get to the fun stuff: writing your first script.
How to Create Your First AutoHotkey Script
Running the AutoHotkey application now won’t actually do anything but launch its help page. To get started, you need to have a script that tells AutoHotkey about your custom keyboard shortcuts. So let’s start by creating one.
Right-click on your Desktop (or any other folder) and choose New > AutoHotkey script. This will create a new file with the .ahk extension in that folder. Name the file whatever you want, then right-click on it and open it in Notepad. (or a more code-friendly program like Notepad++, if you have it). There will be some text in the file. For simple scripts like were demonstrating here, it can be removed. As you get more advanced, you may want to leave it in.
You will be given a nearly-blank slate for you to create the keyboard shortcuts of your dreams. Here are a couple examples.
Let’s start with a real simple character insertion script. I have a script I use every day to allow me to type common characters from German that aren’t on my English keyboard. Let’s say I want to type the ß character whenever I press Alt+Shift+S on my keyboard. In AutoHotkey, that would look like this:
!+s:: Send, ß
Let’s break that bit of text down:
- ! is the symbol for the Alt key
- + is the symbol for the Shift key
- s stands for (obviously) the S key
- :: denotes what you want the preceeding keys to run when pressed together
- Send, is a command that types the proceeding text
- ß is the text we want the command to type.
Essentially, this command says “When Alt, Shift, and S are pressed at the same time, type ß.”
You can add other modifiers, too. For example, if you add the < symbol before your hotkey (so it reads
<!+s:: Send, ß , you can tell AutoHotkey to only run the command if the Left Alt key is used.
My entire German-symbol-hotkey script looks like this:
<!a:: Send, ä <!o:: Send, ö <!u:: Send, ü <!+a:: Send, Ä <!+o:: Send, Ö <!+u:: Send, Ü <!+s:: Send, ß <!+$:: Send, €
You can take this further than just individual characters, too. If you find yourself regularly struggling to translate complex, obnoxious, or just plain long character strings from your brain to your fingers, AutoHotkey is your new best friend. In my other job, I often have to reach out to individuals at other institutions to discuss security items on projects without any introduction from the people I work with. This requires I explain who I am and why I’m contacting them. Instead of typing out this whole message I use a hotstring in AHK. The script looks like this:
:*: at the beginning tells AHK to watch for the sting that follows it. In this case that string is
ncm (short for “new cold message” in my head). So any time I type the letters ncm in a box, it will swap them with the string of text that follows the
:: in the script. Not only have I turned a paragraph worth of typing into three keystrokes, I know it’s going to be right every time.
This could be accomplished with a hotkey instead of hotscript too. You could replace
:*:ncm in the script with
!+n and have the same string of text show up with you pressed Alt+N on your keyboard.
AutoHotkey also has the ability to pull basic info from your computer. For example, it can get today’s date. So if you’re someone who is entering the date into a lot of fields, this script could be a lifesaver.
If you run this script, AutoHotkey will drop the current date in wherever your cursor is. You can play with things like formatting ( dd/MM/yyyy versus MM/dd/yyyy for example) in the script as well.
Going Further: Run Programs, Remap Shortcuts, and More
AutoHotkey can do a lot more than insert text (although that is one of its more common uses). You can also use it to run a program when you press a certain key, remap shortucts like Alt+Tab to hotkeys of your choice, or remap buttons on your mouse. If you get really deep, you can even create dialog boxes or full-fledged programs with AutoHotkey.
You can see the different symbols for hotkeys in AutoHotkey’s documentation. You can also see their beginner’s tutorial for even more examples of stuff you can do in a script. If you ever get stuck, the AutoHotkey forum is a great place to search, ask questions, and learn more about what AutoHotkey can do.
- › How to Sign up for Apple One on iPhone and iPad
- › How to View 3D Halloween Characters in AR Using Your Phone
- › How to Set Up and Use Home & Away Routines with Google Assistant
- › How to Track Changes in a Microsoft PowerPoint Presentation
- › How to Bookmark Multiple Tabs in Safari on iPhone and iPad