The Quick AutoHotkey Guide for Beginners
Whatsapp Pinterest
Advertisement

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 - the shortcut scripting language

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 installer

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

AutoHotkey help document welcome

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]

Simple Script expanding "btw" to "by the way"

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.

The "btw" script in action

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 Text Editors vs. IDEs: Which One Is Better For Programmers? Text Editors vs. IDEs: Which One Is Better For Programmers? Choosing between an advanced IDE and a simpler text editor can be hard. We offer some insight to help you make that decision. Read More , and enter the following:

#s::Run https://duckduckgo.com/?q=%clipboard% 

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

Make sure to save scripts with the AHK extension

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.

Running AutoHotkey scripts can be found in the system tray

To test it out, copy any piece of text, followed by Win + S.

Instant DuckDuckGo searching with AutoHotkey

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.

#s::Run https://www.youtube.com/results?search_query=%clipboard%

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!

YouTube Searching with a Shortcut Key

This might just be the fastest possible way to search YouTube, which puts it up there with some of the best YouTube URL tricks 10 YouTube URL Tricks You Should Know About 10 YouTube URL Tricks You Should Know About Love YouTube? You can make it even better with these cool YouTube URL tricks that let you download videos, make GIFs, and more. Read More !

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 Windows Keyboard Shortcuts 101: The Ultimate Guide Windows Keyboard Shortcuts 101: The Ultimate Guide Keyboard shortcuts can save you hours of time. Master the universal Windows keyboard shortcuts, keyboard tricks for specific programs, and a few other tips to speed up your work. Read More to see if the shortcut you want to make already exists!

Explore more about: AutoHotkey, Computer Automation, Keyboard Shortcuts.

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Richard
    March 19, 2019 at 2:46 pm

    Hello. Great article! I already use AutoHotkey and enjoy it a lot. The link provided for the monitor-sleep.ahk file sends to a "This page has been removed!" Can you please provide the actual code? I would be interested to add it to my AutoHotkey file. Thanks

    • Ian Buckley
      March 19, 2019 at 2:53 pm

      Sure thing, just add this line:

      F1::PostMessage, 0x0112, 0xF170, % (i:=!i)?2:-1,, A ; << F1 sleeps the monitor That'll map F1, of course you can change it to any combination you like!