A logo that says ‘OP&C’

Use AutoHotkey to speed up your work

Create text expansions and custom keyboard shortcuts to work more efficiently with your computer.

Install AutoHotkey and you can use its scripting language to create customised text expansions and keyboard shortcuts for yourself.

Using keyboard shortcuts can be much faster than pointing and clicking with a mouse, especially if you’re working with text.

Text expansion

As part of your day to day computer work you might need to type the same phrase many times.

For example, signing your name at the end of an email.

What if you could type a quick combo of letters, and your email sign off would type itself?

Pro-tip: choose a seldomly-used character to start off an expansion so you don’t trigger one by accident. I use ].


Typing ]sig prints my email signature.

The lines in the script:

; Writes my email signature
; ]sig
::]sig::Best regards,{Shift Down}{Enter}{Shift Up}Golan Trevize

The result:

Best regards,
Golan Trevize

Typing ]hth prints a different email signature.

The lines in the script:

; Writes Hope that helps!
; ]hth
::]hth::Hope that helps!{Shift Down}{Enter}{Shift Up}Salvor Hardin

The result:

Hope that helps!
Salvor Hardin

In AutoHotkey these are called Hotstrings. See Hotstrings – Definition & Usage on the AutoHotkey website for more examples.

Keyboard shortcuts

You already know some keyboard shortcuts. Using keyboard shortcuts speeds up your work. You don’t need to take your hand off the keyboard to reach for the mouse and click through menus to find the command.

Ctrl+S = Save that file. Ctrl+C = Copy that thing. Ctrl+V = Paste that thing. Ctrl+Z = Undo that last thing. (Windows, obvs)

What if you could make your own custom keyboard shortcuts to open files, folders, and programs?

Pro-tip: use a typically unused key as the modifier key so your custom shortcuts don’t clash with any already reserved by your OS or program. I use CapsLock.

Example: Calculator

Make the CapsLock+C keyboard combination launch the calculator app (or switch to it, if there is already an instance running).

; Open Calculator or switch to it if already open
; CapsLock+c
CapsLock & c::
	if WinExist("Calculator") {
		Run, calc.exe

Example: open a specific webpage in your default browser

Make the CapsLock+T keyboard combination open https://cn.bing.com/translator so you can copy-paste some text to check a rough translation of English to Chinese or vice-versa.

; Open https://cn.bing.com/translator
; CapsLock+t
CapsLock & t::
	Run, https://cn.bing.com/translator

Example: print a special character

I often want to type a , but in the text editor that key puts in a '. I have CapsLock+' set to print a .

; Shortcut for a right single quote because I type it so much ’ 
; CapsLock+'
CapsLock & '::

Same with ¥ (CapsLock+Y)

Example: view recently used files

The Caching chapter of Algorithms to Live By (Christian & Griffiths, 2020) mentions a “Noguchi Filing System” that is an extension of the Least Recently Used (LRU) approach to caching.

In this approach the cache is likened to a pile of things—after you finish using a thing you place it on the top of the pile; if the cache becomes full, things on the bottom of the pile (the least recently used things) are evicted from the cache. When you’re searching for something in the cache, you start at the top of the pile, with the assumption that you’ll be looking for something you used recently.

A computer science study of caching techniques referenced in that chapter leads the authors to conclude that using the Noguchi Filing System is “not merely efficient. It’s actually optimal.”

The Recent Items folder in Windows contains the pile of things (e.g. files, folders, pictures) that you have recently had open on your computer, with the most recently used things at the top—exactly the same as the Noguchi system.

The Recent Items folder is hidden away, but a simple keyboard combo (e.g. CapsLock+R) can have it open in a flash for you to find your files faster.

; Shortcut to open a window with recent files
; CapsLock+r
CapsLock & r::
	Run, EXPLORER.EXE "%UserProfile%\AppData\Roaming\Microsoft\Windows\Recent"

In AutoHotkey these keyboard combinations are called Hotkeys. See Hotkeys – Definition & Usage on the AutoHotkey website for more examples.

Now try it yourself?

  1. Download and install AutoHotkey (Windows only)
  2. Collect your Hotstrings and Hotkeys in an AutoHotkey script
  3. Use Task Scheduler to run that script at startup (Read about that at blog.danskingdom.com)
  4. Optional: have that script in a folder that syncs between your other computers so your keyboard shortcuts follow you around. (You could try Syncthing instead of OneDrive or Dropbox.)