AutoHotkey Text Expansion

Being incredibly lazy, I am always on the lookout for ways to automate my life. Something I heard about a long time ago, but never got around to looking at was AutoHotKey. Now it is an essential tool I used everyday for text macros.

I was listing to a Relay podcast called Automaters, and the hosts (David Sparks & Rose Orchard) were talking about some Mac software called Text Expander. They both use it heavily to save them time on mundane every day tasks where generic information is needed. Sadly it isn’t available for Windows.

AutoHotKey is available for windows however. It is a compiled macro scripting  language, not just a text replacement program, meaning it can be incredibly powerful depending on how you use it. For example, it can be used along with some hardware to plug in multiple keyboards and make an insane number of macros.

Creating a AutoHotKey Script

Once AHK is installed, right click in file explorer to create a new script. Once you have finished writing the script, right click it again and compile. The resulting .exe can be added to the startup folder to launch every time your computer starts. Alternatively you can create scripts for specific application and launch them together.

Text replacement is simple, the syntax looks like:

::sometext::someothertext
::ws-::procrastinatingengineer.uk

This will replace “sometext” with “someothertext” as soon as you press another key, and “ws-” with “procrastinatingengineer.uk”.
I used this as a short cut for phone numbers, email addresses and all sorts of other info. The ‘-‘ is just something I use to make it a string combination that I am unlikely to type in everyday use. It is also the reverse of Linux command line flags. What more could an automation loving nerd want?

Another really useful part of the script is:

 PrintScreen::AppsKey

This takes the print screen key and re-maps it to the Windows Menu Key (AKA Application Key), which works the same way in most applications as a right mouse click. As a programmer, bad speller (yay spell check), and a generally key board heavy user, I use this key all the time! My ThinkPad laptop doesn’t have a menu key, and the print screen in it’s layout is in almost the same place, so it’s a nice alteration.

Did I also mention that AHK is free? 😁

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.