Universal AutoCorrect with AutoHotkey and Wikipedia

Be sure to read the final update at the end of this post! The script now lives at AutoHotkey.

I've really been enjoying AutoHotkey, a tool that lets you execute macros, text expansion, custom keyboard shortcuts, etc. My favorite feature is the text expansion, where it watches what you type and when it recognizes an abbreviation you've defined it will expand it automatically, no matter which application you're typing in. So "ttyl" could be automatically expanded to "talk to you later" in an e-mail, instant message, Word document, browser forms, etc. Very handy.

Anyway, you've probably noticed Word has an "AutoCorrect" feature where it corrects common misspellings on the fly. For example, "teh" gets instantly corrected to "the". I was thinking it would be great to use AutoHotkey to get that same functionality in any application. I had slowly been adding my own most common typos to an AutoHotkey script, and it worked great, but then I thought it would be nice to have a more comprehensive list. Enter Wikipedia, and its lists of common misspellings! I grabbed the machine-readable download, parsed it, commented out the ambiguous entries (see comments in the script), added in my own personal gotchas, and loaded it. Cross-application AutoCorrect! Here's a zip file containing the script if you want to give it a try:

  • wikipedia_autocorrect.zip See UPDATE 5 below for the script's new home.

You'll need AutoHotkey installed, of course. And note the "Hotstring" feature this technique uses is only available on Windows NT/2000/XP or higher.

UPDATE: Adam at Lifehacker linked this up, thanks! He notes I could have compiled this for non-AutoHotkey users. I probably should have, but didn't because I just assumed folks would want to add their own common misspellings. But if you just want to run it without installing AutoHotkey, Adam has made a compiled version available via his post. Very cool.

UPDATE 2: I updated this script to include Tara Gibb's enhancement (see below) and a few more of my own common misspellings. The enhancement lets you highlight a misspelling and hit WIN+H to easily add the correction to the script (so it's self-updating). A nice way to flesh the script out with your own spelling foibles (another reason to not run the compiled version provided at Lifehacker, as this feature won't work there).

UPDATE 3: Quite excitingly, Chris Mallett, the author of AutoHotkey, found this script and linked it up! He also made a couple improvements, which are now reflected in the script available above. I tossed in a few more of my personal common misspellings while I was at it.

UPDATE 4: Reader Shane submitted a pile of Word AutoCorrect words for inclusion, so I folded those in (after removing duplicates). Thanks Shane! While I was at it I also folded in a bunch more of my personal misspellings. In all, there's probably around 700 more entries in the latest version.

UPDATE 5: Chris Mallet and the AutoHotkey community have taken this script under their wing. Specifically, Dewi Morgan has made some terrific improvements, cleaned up the code, and added many more words. I think that version should be considered the definitive version, and is available from the AutoHotkey site. Very cool!