Affiliate Disclosure: By buying the products we recommend, you help keep the lights on at MakeUseOf. Read more.
Learning the keyboard shortcuts to your system and software changes the user experience. In most cases, it makes you more productive and able to achieve more in less time. Other shortcuts aim to improve quality of life.
AutoHotkey takes this idea one step further and allows you to create custom shortcuts for almost any task you perform on your computer. AutoHotkey is addictive once you become proficient. but for now, let’s learn the basics with this guide for beginners.
What Can AutoHotkey Do?
AutoHotkey is a scripting language that allows the creation of macros and scripts, typically triggered using hotkeys. Examples of common uses for AutoHotkey are:
- Creating new shortcuts in Windows.
- Automating data entry work and auto-filling online forms.
- Expanding abbreviations, for instance expanding “IDK” to “I don’t know.”
- Controlling the mouse via keyboard or joystick
How to Install AutoHotkey in Windows
AutoHotkey is open source and available for Windows. To install AutoHotkey, head to the official AutoHotkey website and click download. On the following screen, select Download AutoHotkey Installer and the download should begin automatically.
Installing with the default settings is recommended. But if you are using a 32-bit system, use the Custom Installation option to install the correct version. There is also a version for the ANSI character set. This is not something you’ll need, though some older scripts rely on it.
How to Use AutoHotkey
After installation, locate AutoHotkey in the Start menu and open it. You will see the help document, which AutoHotkey has in place of a traditional GUI. The simplest way to use AutoHotkey is to use scripts already made by others. This script will convert “btw” to “by the way” every time you type it.
Download: by the way.ahk [No Longer Available]
This image shows what the script contains. Double click on the script to launch it, then try it out by opening any text editor or browser window and typing btw.
Pretty cool, but maybe not that practical. How about something you can use every day?
Try This Instant Monitor Killer
AutoHotkey can also send system commands. If you work at your computer all day, there are probably times when you won’t be actively using it but don’t want to turn it off. This script will instantly cut the signal to your screen, rather than waiting for it to time out or for a screensaver to trigger.
Download: monitor_sleep.ahk [No Longer Available]
Once downloaded, open the script and press F1. Wake it up again by moving the mouse or pressing any key on the keyboard. AutoHotkey can control many elements of your system in similar ways to this, including sending shutdown commands, open custom Windows Explorers, and even commands on the command line.
Create an AutoHotkey Script from Scratch
So far you’ve been using other people’s scripts. Now, let’s create a simple sketch from scratch which will take whatever is on our clipboard and search it with Duck Duck Go. Right click on the Windows desktop and select New > AutoHotkey Script. Alternatively, you could use any text editor or IDE of your choice, and enter the following:
The #s refers to the shortcut to trigger the script. The hash symbol refers to the Windows key, meaning that Win + S is our chosen shortcut. This shortcut is reserved for Windows 10’s search function. In this case, we are overriding it, meaning the DuckDuckGo search will happen in its place. If you use the Windows search shortcut, replace this with a different letter.
The Run command is one of AutoHotkeys multi-tools. According to the documentation it will open “A document, URL, executable file (.exe, .com, .bat, etc.), shortcut (.lnk), or system verb…” In this case, AutoHotkey will open the URL in the default browser.
Finally, the ?q=%clipboard% part is a command to append the URL with the contents of the Windows clipboard.
Save and Run Your First Script
Save the file under File > Save As, naming your file, and giving it the ahk extension. Once saved, navigate to your file and open it. It might appear that nothing has happened, but the script is now running in the background. To check if it has launched, look in the system tray in the bottom right of the screen.
To test it out, copy any piece of text, followed by Win + S.
Not a bad timesaver! This program will run in the background until you close it or log off. To stop the script, right click on its system tray icon, and select Exit. Alternatively, if you only want to disable the script temporarily, select Suspend Hotkeys. The script will remain open, yet inactive until resumed.
How to Edit AutoHotkey Scripts
Let’s say you decided to switch the search to YouTube. To edit an AutoHotkey script, right click on it and select Edit Script. This will open the script in your default text editor. The URL for searching YouTube is slightly different.
Save the script. You can use this script straight away without closing and reopening the script. Instead, right click on the system tray icon and select Reload This Script. Copy something to your clipboard and try it out!
This might just be the fastest possible way to search YouTube, which puts it up there with some of the best YouTube URL tricks!
Automate Your Repetitive Tasks With AutoHotkey
AutoHotkey is capable of a lot, and to say this tutorial barely scratches the surface would be an understatement. We have covered many essential AutoHotkey scripts in the past, and there are many more out there which can make your life easier.
Learning to create custom AutoHotkey scripts is also a great skill, though it is worth checking the Windows Keyboard Shortcut Ultimate Guide to see if the shortcut you want to make already exists!