Autohotkey

logoAutohotkey is free. It’s also the best text expander known to man – free or otherwise.

If you don’t know what a text expander is, read this JustWondering post before you delve any deeper, but if you do any typing on a computer you do need a text expander.

Mac and Linux users, you’re out of luck. For the Mac I recommend the excellent Typinator, and for Linux the only alternative is the clunky but effective Autokey.

Getting started with Autohotkey

  1. Download Autohotkey from the first link on this page.
  2. Run the downloaded exe file.
  3. Right-click anywhere on your desktop, or in a Windows Explorer folder of your choice.
  4. In the pop-up menu, select New » AutoHotkey Script. (or select New » Text Document.)
  5. Give the file a name, ensuring that it ends in .ahk. e.g. mykeys.ahk
  6. Right-click on the file and choose Edit Script.
  7. Type the following:#z::Run www.google.com
  8. Save the file.
  9. Run the file by double-clicking it. An Autohotkey icon appears in your notification area.
  10. Type WinKey+z.

What have you just done?

Use Autohotkey with Dropbox

If you put your Autohotkey text file or files in your Dropbox you get automatic backup and synchronisation between your computers.
Don’t have Dropbox? Oh dear, you are missing out. Read about it right here on Just Wondering.

The # symbol represents the Windows key, the double colon tells Autohotkey to execute the following command which opens the Google home page in your default browser.
Autohotkey have extensive documentation on their website. The program, tiny though it is, is very powerful and for non-geeks can be a little overwhelming. If you’re not a PC guru, read the rest of this page before getting into Autohotkey’s documentation. The main thing you need to know is this:
To set up a basic text expansion, add a line to your Autohotkey script file with two colons, an abbreviation of your choice, two more colons, then the required text. Just like this:
::fwiw::for what it's worth
After you’ve saved and reloaded the Autohotkey script, when you type fwiw in any program which accepts text input, Autohotkey will replace fwiw with for what it’s worth.

Here’s a bunch of examples

What’s the asterix for?

An * between the first two colons tells Autohotkey to execute immediately—without requiring an activation key (space bar, period, comma, Enter, etc.) This can be useful in some circumstances, for instance, shortcuts you wish to enter into online forms or text boxes.

I usually find it useful to double up on the first letter of a shortcut. That often avoids using key combinations already hijacked by short words in the English language. As, no, it, for instance.  It also gives consistency and the double letter is easier to type quickly than other methods, like using ~ or ` before a shortcut.
::hhome::13 MyHome St{Enter}City Central{Enter}Whanganui{Enter}4500
:*:nnz::New Zealand (Why the asterisk? See the note in the pullout at right.)
::uus::the United States
::pph::Phone: 01 2345 6789{enter}Mobile: 021 123 4567
:*:ggml::myEmailName@gmail.com
:*:mwu::http://www.mistywindow.com/
:*:mmse::Microsoft Security Essentials
:*:mmsw::Microsoft Windows
::nnyt::New York Times
::oos::operating system
::tte::text expander
::ww::Windows
::kb::keyboard
::kbss::keyboard shortcuts
::cliche::cliché
::afa::as far as I know

Launching, saving and reloading Autohotkey

The best way to launch an Autohotkey script is to place a shortcut to the file in your Windows Startup menu so that it opens when you start Windows. Otherwise you can place a shortcut on your Desktop and start it whenever you please.
Autohotkey pop-up menu
Once a script is run, an Autohotkey icon appears in your Notification area. Right click on it to bring up the pop-up menu—shown at right—from which you can choose to edit the file. After editing and saving the file, the same pop-up menu allows you to re-load the script so that you enable the changes you’ve saved.
Once you get the hang of it:

More complicated stuff

Open a web page:

#z::Run www.mistywindow.com

Insert date as YYYY-MM-DD

^!d::send %A_YYYY%-%A_MM%-%A_DD%

To run a program:
In this case, the excellent and free Notepad++

^!n::

IfWinExist Untitled – Notepad++
WinActivate
else
Run Notepad++
return

For coders: key codes for Autohotkey

# press Windows key
^ press Ctrl key
! press Alt key
+ press Shift key
{Enter} press Enter key
{tab} press Tab key
{left x} move cursor left x spaces
substitute right, up, down as required

:*:sstr::<strong></strong>
:*:bbqu::<blockquote style="color:darkblue">{Enter}</blockquote>{left 13}
:*:bbr::<br />
:*:ccall::[callout title=Callout Title][/callout]{left 10}
:*:ccntr::<center>{Enter}</center>{left 9}
:*:ddv::<div>{Enter}</div>{left 6}
:*:ddcntr::<div style="text-align: center;">{Enter}</div>{left 6}
::eem::<em></em>{left 5}
:*:imgrt::class="alignright" style="margin: 10px 0px 10px 10px;"
:*:imglt::class="alignleft" style="margin: 10px 10px 10px 0px;"
:*:llnk::<a href="url"></a>{left 4}
::pp::<p>{Enter}</p>{left 4}
:*:ppcntr::<p style="text-align: center;">{Enter}</p>{left 4}
:*:pprt::<p style="text-align: right;">{Enter}</p>{left 4}
:*:pplt::<p style="text-align: left;">{Enter}</p>{left 4}
:*:ppull::<pullout>{Enter}</pullout>{left 10}
:*:qquote::<quote>{Enter}</quote>{left 8}{Enter}
:*:sspan::<span>{Enter}</span>{left 7}
:*:ssb::<sub></sub>{left 6}
:*:ssp::<sup></sup>{left 6}
:*:uul::<u></u>{left 4}
::wwplb::<div style="height: 1em; visibility: hidden;">this is a dummy line break for WordPress</div>
::rr301::redirect 301
:*:pphp::<?php{Enter}{Enter}?>{up}