AutoHotkey (AHK) is a powerful automation tool that can transform the way you interact with Windows. With simple scripts, you can fix some of Windows' annoying limitations by adding missing features. This guide showcases practical examples of how I do that.

This is not an in-depth tutorial on AHK, so you can use these scripts as is or as inspiration to explore the program more and create your own. With that said, let’s dive in.

create-ahk-script-windows

What Is AutoHotkey?

AutoHotkey is a scripting language that helps you automate repetitive tasks on Windows. It’s a lightweight and versatile tool for enhancing productivity and creating custom workflows. You might be feeling intimidated at this point, thinking AHK is mostly for programmers, but I assure you, it’s easy to learn. Once you see how easy to follow many of the scripts in the guide are, you will realize how intuitive, yet powerful, AutoHotkey is.

How to Create and Run a Script in AutoHotkey

To start, you need todownload AutoHotKey v2.0and install it on your computer. Next, right-click an empty part of the desktop or File Explorer and select New > AutoHotkey Script.

Give the script a name and click the “Create” button. This creates a blank text file with an AHK extension. you’re able to also use any text editor (e.g., Notepad, Notepad++, or Visual Studio Code) to create an AutoHotkey script.

new-script-ahk-windows

Now, right-click the script and select Show more options > Edit Script. Paste the code you want to run into the text editor and save it by pressing Ctrl+S or clicking File > Save—these are the most common ways to save a file on Windows. Afterward, right-click the script and select “Open” in the menu. Alternatively, you can just double-click to run it.

You can verify the script is running by checking the system tray. Look for the AHK icon with the name of the file. If you need scripts to run after you boot up your PC, you canmake them a startup program. Just place them in the “C:\Users[User]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup” folder. Here,[User]is your Windows username.

open-ahk-script-windows

How I Use AutoHotKey to Improve My Windows Experience

Now that you are familiar with creating AHK scripts, let’s look at some useful scripts I use to make the Windows experience more enjoyable.

Open Anything With a Shortcut

AHK allows you to open apps, files, or folders using global shortcuts. No need for multiple clicks through menus or the Start menu to access what you need.

Here is a script that opens Google Chrome using the Ctrl+Alt+G shortcut:

Keep in mind that AutoHotkey will ignore any line of code that starts with a semicolon (;), as these are considered comments in the world of programming. The next line of code is what it will execute. Here^is Ctrl,!is Alt, andgis, well, the G key. The double colons (::) separate the hotkey definition from the action to perform (Run “C:\Program Files\Google\Chrome\Application\chrome.exe”).

For more information on what the characters mean in the scripts,take a look at the AHK documentation.

You can customize the above script to suit your needs. For instance, you can replace g with another key. You can also replace the file path of Chrome with Asana’s if that is what you want to open instead.

If you want to open multiple apps, files, and folders with a single shortcut, you may insert the code to run them inside angled brackets, like in the example below:

Without AHK, one way to achieve this is touse Power Automate for desktop to automate repetitive tasks. Using AHK in this instance is faster.

Quickly Search Google

If you see a word and want to Google search it, you have to open a browser, type it in, and hit the Enter key. Don’t you wish Windows would allow you to highlight it and hit a few keys to do that? It’s possible, but with AutoHotkey.

Here is the script to make that happen when you hit Ctrl+Shift+G:

The search results will open in your PC’s default browser. If it opens a browser you don’t use (e.g., Edge instead of Chrome), you canchange your default browser on Windowswith a few clicks.

An Easier Way to Insert Special Characters

There is no easy way to insert special characters on Windows without relying on the On-Screen Keyboard oropening a forgotten tool like the Character Map. But with AHK, you’re able to assign them to custom shortcuts and insert them anywhere with ease.

Here is the AHK script that inserts the copyright symbol (©) when you press Alt+Q:

Insert Frequently Used Text Snippets

Have you ever found yourself typing the same phrases over and over again, and wish Windows could offer a way to do these tedious actions with shortcuts? Well, AutoHotkey is the solution, as it allows you to insert frequently used text snippets with just a few keystrokes.

Here is an example of a script that insertsby the waywhenever you typebtwfollowed by the Space key.

Although a little more complex, you can also insert multi-line text. For instance, this script can help if you’re tired of writing the same email signature every time. Here is an example:

Now, whenever you enteremailsigwhile the script is running, it will insert the email signature. The{Enter}notation signifies where AHK will enter a new line, just like you would after typing part of the signature and pressing the Enter key.

Add AutoCorrect to Windows

I hate that Windows doesn’t have a built-in autocorrect feature that works across all applications to correct those common and frustrating typos. Below is a script that can solve this problem:

You can expand that list with more words that you misspell frequently. Consider keeping a running list of your common typos to add to this script over time.

A Simple Text Case Converter

Another frustrating thing I constantly run into is that there just isn’t any text case converter on Windows. If I want some text to be all in uppercase or vice versa after typing it in Notepad or Sticky Notes, I generally have to type it again. With a simple AHK script, I can instantly convert it with a shortcut.

The AHK script below turns all letters to uppercase when you press Ctrl+Shift+U and lowercase when Ctrl+Shift+L is pressed (make sure you highlight the text first):

Quickly Shutdown Windows

Shutting down your PC usually requires clicking Start > Power > Shutdown or long-pressing the power button. But with AHK, you may create a simple shortcut to start the shutdown process. This can be especially useful when you need to quickly power off your computer if you need to leave right away and don’t have the time to navigate menus.

Here is a script that shuts down Windows immediately when you press Ctrl+Shift+End:

And here’s one for restarting your PC with Win+Shift+R:

Minimize All Windows Except the Active One

Ever need to focus on just one window and get rid of all the other clutter? You can minimize them all with the Win+M shortcut, but there isn’t one for minimizing all windows except the one you’re working with.

AutoHotkey can remedy that with the script below. It minimizes all windows except the active one when you press Win+Shift+M.

If you find more than one script useful, you don’t have to create a separate AHK file for it. You can combine all of them in one file, and it will execute them all (as long as the hotkeys don’t conflict with each other).

These are all simple scripts, but they can get more advanced than this. If you want to dive deeper into AHK, there are plenty of resources online on top of the documentation, including tutorials, YouTube videos, and community forums.