How to Automate your computer with AutoHotKey

Whenever you have the chance to set up something that will repeatedly save you time over and over again with no additional effort, it’s usually worth exploring.

Let me give you an example:

Do you have a workflow that you run through on a regular basis that requires you to open the same several websites each time you do it? If you bookmark those sites and nest them into a folder, you can open all the bookmarks in one step by right-clicking the folder > Open All in Tabs.

Open All in Tabs

Set this up once, and it will repay you with saved time over and over again. This is the kind of thing I’m talking about.

In this article, I’m going to show you how I created a script using a free program called AutoHotKey that automates my entire workflow for setting up my computer for recording a software tutorial. What used to take me 5-10 minutes, now takes seconds, is more reliable and way less frustrating.

What can AutoHotKey do?

AutoHotKey can do pretty much anything a human can do on your computer, from opening programs, custom auto-correct, moving windows, clicking on things, sending keyboard input, and much more. You can even add logic so your script knows how to make decisions on the fly. It just takes a little bit of programming know-how.

You can create simple scripts that trigger when you press a certain key combination. For example, this one line of code will auto-replace wtf with What the Fr*ench toast, wherever you type it:

::wtf::What the Fr*nch Toast!

Or you can create more advanced scripts that open programs and resize their windows.

I’m not a professional coder, but I’ve played around with PHP, Javascript, and Ruby, and I found AutoHotKey’s language to be pretty simple to pick up. You can check out the official AutoHotKey beginner tutorial here, and if you’re new to programming, I’d recommend taking a course, like this free one on Ruby from Code Academy.

My process for recording a software tutorial looks like this:

  1. Open the software I want to create a tutorial for.
  2. Resize and position the window to the appropriate size and ratio. ( I use Sizer to precisely set the size of windows.)
  3. Open OBS. (Free screen recording software.)
  4. Record tutorial.
  5. Create a new project folder.
  6. Copy & paste template video file and template YouTube thumbnail file into the project folder.
  7. Cut & paste resulting screencast videos from the default location to the project folder.

These are all steps I’d have to take on every single tutorial I created. With AutoHotKey, I can automate most of these steps. Now, I just double-click an icon on my desktop, and this is what happens:

  1. A window pops up asking me which program I want to create the tutorial in. (On my other YouTube channel, I create tutorials for SketchUp and LayOut.)
  2. A second prompt lets me create a new project folder for this tutorial (saved in a default folder I predetermined.).
  3. A third window lets me choose a project name to use for the template files.

Next, the following all happens automatically.

  • The programs I selected open up, resize, and reposition automatically.
  • A new project folder is created automatically, and a sub-folder called Screencast is created inside to hold all the screencast footage.
  • OBS opens automatically and docks on the right side of my second monitor.
  • The default output folder for OBS is automatically changed to the newly created project’s Screencast folder.
  • My video template file and YouTube thumbnail file are automatically copied into the project folder and are renamed according to the project name I chose previously.
SketchUp opens and scales to the exact size and position I need, then OBS opens, configures its output folder then docks to the right side of my 2nd monitor.

All of this happens within seconds. And once I’m done recording, the file is automatically saved in the project folder.

Not only was I able to save time over doing all this manually, but I was able to add even more value by automatically changing the default output folder from OBS so the videos are automatically placed in the appropriate folder.

Hey Matt! Why don’t you record tutorials full screen? Many people watch YouTube on their phone, so if I recorded in full screen, the icons and cursor would be too small. Instead, I found that if I record a window at 2560×1440, it’s a good compromise in size. The screencast ultimately gets scaled down to 1920×1080 in the final video.

How to create a script in AutoHotKey

After downloading and installing AutoHotKey, it’s a little weird because it’s not like a program that you open and create scripts in. Instead, you’re actually installing the scripting language onto your computer, and you just use a notepad app like Notepad++ to create new scripts. As long as you save the file with the .ahk extension, you’ll then be able to open the file to run the script.

Many times, .ahk scripts run silently in the background, awaiting certain conditions before executing an action. Maybe you want something to trigger when you press a certain key combination, or when a certain program opens.

For example, consider the following AutoHotKey script:

Send This will be typed

^d:: The first line is a hotkey. ^ means the CTRL key, and d is the letter d. When you press this hotkey, the script will continue. Otherwise, the script just patiently sits in the background until the hotkey is pressed.

Send This will be typed The second line starts with the Send command, which will send keystrokes. Whatever comes after is what will be typed.

return Stops the code from going any further.

So if this script was running, and you had notepad open and you pressed CTRL + d, you’d see this:

Discovering Commands

So how did I know about the Send command, and how did I know that the words typed after the comma would be sent?

In the documentation site for AutoHotKey, it shows you all the available commands and how to use them. Here are some examples:

Sends simulated keystrokes and mouse clicks to the active window.

Shows an input box for the user to enter some text. The text gets saved in a variable that you can use later in your code. You can also provide optional parameters like a title, prompt, width, height, position, and more.

Changes the size and/or position of a window.

Create a new folder on your hard drive.

For the specific script I created for my tutorial workflow, I used GUI (which stands for Graphic User Interface) to create a popup window so I can select the programs I want to open. FileSelectFolder was used to select a folder. FileCopy copied my template files and pasted them in the new project folder. I then used WinActivate to select the various program windows and WinMove to resize and position them where I need them.

It definitely takes some time to become familiar with all the different commands at your disposal, but if you get stuck, you can usually find what you need with a quick Google search.

For example, I was trying to figure out how to send the current year.

So I Googled “AutoHotKey current date” and found a forum post that mentioned A_YYYY, A_MM, A_DD, and A_Now variables.

Back on the AutoHotKey website, I then used the search function to search for A_YYYY and discovered that there are a ton of built-in variables that you can call on in your code to insert dynamic values. A_YYYY is the current 4-digit year. So if I used that variable, its value would be 2020.

So combining a Google search with the search function on AutoHotKey’s website is a great way to learn as you go.

If you’re really going to dive into AutoHotKey, there are some code editors specially made for AutoHotKey that can make your life a lot easier. I recommend downloading SciTE4AutoHotkey, because it provides syntax highlighting, autocomplete, AutoHotkey help integration, and an easy-to-use GUI builder.

Easier Alternatives

If you find AutoHotKey to be overwhelming or too complicated, there are some other options I’ve used in the past that work well too. These aren’t as powerful as AutoHotKey, but are much easier to use if you’re not good with programming.

Phrase Express is like your own personal AutoCorrect engine. You can create custom keyboard shortcuts that automatically autocorrect to whatever you want. You can do this with AutoHotKey, but Phrase Express is a little easier to set up.

Here are some of the shortcuts I’ve been using with Phrase Express:

Today’s Date

#da is the shortcode I use for today’s date. I just need to type those three letters, and the text will magically correct to today’s date, in this case 4/24/20.

Logo Color

mso is the shortcode I use to paste my logo color RGB code. There are so many different tools I use in my business and I’m constantly having to select my logo color, so no matter what tool I’m in, I can just type those three letters, and it will autocorrect to my RGB code.

Custom signature

I also have a custom email signature set up to a shortcode, when I’m sending out more personal emails. I’ve also used Phrase Express to set up canned responses for commonly asked questions from my audience. You don’t have to always use keyboard shortcuts too, you can simply select the canned responses from the taskbar.

Macro Recorder $49.95 is another program made by the same company, but this one can record your mouse and keyboard, and replay those actions as many times as you want. It’s not as powerful as AutoHotKey, but it’s more accessible to people who don’t know how to code.


Free, open-source scripting language for automating computer tasks. From simple autocorrect or custom keyboard shortcuts, to complex logical operations, AutoHotKey can do it.

AutoHotKey Homepage

AutoHotKey Documentation

Beginner Tutorial

r/AutoHotKey Subreddit full of helpful folks and a ton of knowledge and resources for learning AutoHotKey.

SciTE4AutoHotkey – Custom AutoHotKey script Editor

Phrase Express is like a custom autocorrect utility and is really handy for creating custom keyboard shortcuts for commonly used words or phrases.

Macro Recorder is a very user-friendly automation tool. Record mouse clicks and keyboard input, then replay those macros to automate repetitive tasks.

By Matt Donley

Matt is the creator of onlinebusinesstech where he shares tips, tricks, and tutorials on how to leverage technology when building your own online business.