Add AutoCorrection to All Your Windows PC Programs with AutoHotkey
“For People Who Fall Victim to Typos and Common Misspellings”
by Jack Dunning
Have you ever wished that you could type résumé when your need it without searching for the "é"? Are you like me, a little dyslectic, and occasionally enter "thier" rather than "their" when typing on your keyboard? Or, "hte" when your mean "the"? Microsoft Word has AutoCorrect which will fix these errors, but what if you're using Notepad, blogging on the Web, or sending an e-mail? Do you want a quicker way to enter the trademark symbol (™), copyright (©), or registered trademark (®)? Now you can use a program which will automatically correct common typos and misspellings on the fly and works in any program or any Web page—not just Microsoft Word.
This program uses Wikipedia's "Lists of common misspellings," ''Typo," the Microsoft Office autocorrect list, the OpenOffice autocorrect list, and various other lists. The original program file is rather old, but last time I checked common typos and misspellings haven't changed much in the last century.
This AutoCorrect program is not a replacement for a spell checker, but an extension which immediately makes changes to common errors—not all misspellings. Nor does it scan a previously written document looking for misspellings. It works only while you are typing and corrects the errors immediately without prompting. The list of words is limited to common, not easily confused, mistakes, but there are still over 5,000 entries in the list. Generally, a spell checker merely highlights a word not found in its dictionary, then you make the decision.
This AutoCorrect program is an AutoHotkey script, but since many people may not be interested in installing or learning AutoHotkey, I've compiled the basic file into an executable, AutoCorrect.exe, which will run on any Windows computer—even if AutoHotkey has never been installed. I've posted it as a free download on the AutoHotkey Scripts page in the same folder as past AutoHotkey downloads. If you download the AutoCorrect.exe file and double-click it, you will get the benefit of this program without further installation. If you would like the program to automatically load whenever you log into Windows, open the Startup folder (Run => shell:startup), and add either a copy of the program file or create a shortcut pointing to the program. (I recommend a shortcut.)
Note: When the AutoCorrect.exe file is loaded a green icon with an "H" in it will appear in the System Tray on the right side of the Windows Taskbar. (See the figure to the left). To stop the program, right-click on the icon and select Exit.
The only downside to using the compiled "run-anywhere" program, AutoCorrect.exe, is that you won't be able to modify it for your special needs. If you want to tailor your list of AutoCorrect words, then you must install AutoHotkey and make the modifications yourself to the AHK source file which is in plain text. (The source code I used for AutoCorrect, AutoCorrect.ahk, can be found in the same DropBox download folder.) Even if you don't plan to use the AutoCorrect.ahk file with AutoHotkey, you can view the words included in this version of the program by opening AutoCorrect.ahk with Notepad.
There are many people who could have written this program, but my hat goes off to those who took the time to compile the lists, make corrections, and add new functionality. The original source (unmodified by me) can be found at the AutoHotkey site. (You can review this page on the Web rather than downloading my AutoCorrect.ahk file. It is almost identical except for the changes I note below.) This may be one of the most useful scripts from AutoHotkey and the reason why I'm now offering it to ComputorEdge readers.
How AutoCorrect Works
The operation of AutoCorrect is built on one of the most basic features of AutoHotkey: substitution. Within the script is a long list of common errors. Whenever one of those non-words is typed, it is replaced on the spot with the correct word. Of course errors which are also other real words aren't included. That could become correction chaos. You still need to know whether you want "your" or "you're" when typing, although "you;re" will be changed to "you're."
If you type "btu" it will be replaced with "but", but only if it follows a comma or semicolon and a space. Otherwise you would never be able to use the British Thermal Unit (BTU). "Embarass" becomes "embarrass" even when part of "embarrassment." Here are some random samples from the "a" list:
The word after the first double colon is automatically replaced with the word following the second double colon ("ammused" => "amused") when it is followed by a space or a punctuation mark. It's that simple. After you load the script (double-click AutoCorrect.exe), open Notepad and give it a try.
Fancy Foreign Words in English
If you want to add effete snobbery to your e-mails, then included is a list of foreign words found in English which use those ridiculous accents and umlauts. "He went to the smörgåsbord soirée with his protégé because he wanted some crêpes or a soufflé" or, "Señor will fish for pirañas mañana." You might want to refer to a moral from one of "Æsop's" fables. Is that pretentious enough for you? Here are a few examples from the foreign word file:
Here is one that I added to my list just for all those sports announcers who don't know that many fans have more "athleticism" than any of the players.
athleticism 1. an active interest in sports. 2. an obsessive participation in physical activity.
Now whenever someone wants to use "athleticism" it is automatically changed to" athletic ability." Too bad this doesn't work when the announcers are talking on air. I wanted to change it to, "It's 'athletic ability' you airhead!", but I thought it would be too rude.
::i could care less::I couldn't care lesssince most people actually couldn't care less, even though they say they could.
I've also added a line to change "on accident" to "on purpose" since the former is obviously a Freudian slip used by people trying to hide the truth. Otherwise, they would say "by accident" just like innocent people do. It turns out that "on accident" is commonly used by people under 35 while "by accident" is used by more mature individuals. Some put the blame on Barney and Friends, but that doesn't work since Barney and Friends started airing in 1992. By then my second son, the first person I heard say "on accident," was ten years old and he wouldn't have been caught dead watching that show.
I considered putting in ("gone missing" => "disappeared"), but I've watched too many British mysteries to make that change.
* * *
Tip: AutoHotkey is great for instant correction of commonly misspelled words,but fixing grammar problems is not so easy. For that try the free version of Grammarly proofreader and grammar corrector as shown at right. (Note: Grammarly is a ComputorEdge Software Partner.)
* * *
Correcting the British
If you want to force the British expatriates in your office to be more American, then you will need:
For a more complete list of British spelling variations see Karen's Linguistics Issues and Wikipedia.
There is no limit on making additions to the list, but you can't do it to the compiled AutoCorrect.exe file I posted. You need to start with either theAutoCorrect.ahk file or cut-and-paste the original linked code into a new AutoHotkey AHK file.
What Else is Included?
In addition to the over 5,000 common misspellings and typos, the list includes common word endings ("sice" => "sive") and beginnings ("asociat" => "associat"). There is also a fairly long list of non-operating options that would need to be added to the active list before they could be used. You must decide which result (if any) would work for you. Here is a small portion of that inactive list.
To make any of these changes, install AutoHotkey and update the original AutoCorrect.ahk. Then you can either run the AHK file with the installed software or you can recompile it into the AutoCorrect.exe program which will run on any Windows computer.
This AutoCorrect program will also automatically capitalize the days of the week and months (except March and May which have alternate meanings).
Adding Your Own Corrections
If there are common typing errors for particular words which plague you, and if you're running the AHK file with the installed AutoHotkey program, you can select (highlight) the error and use the WIN+H (+H) hotkey combination to add it to the AutoCorrect.ahk file. For example, suppose mistyping "enoug" when you mean "enough" is a common typo for you. Rather than always going back during proof to edit "enoug", you can add it to the AutoCorrect.ahk file by selecting it and pressing WIN+H (+H). An editing window for adding new corrections will open (see the figure to the left). Simply edit the word on the right to the correct form, then click OK. The correction will be added to the bottom of theAutoCorrect.ahk file. (Remember, this will not work with the AutoCorrect.exe compiled program since you can't add to the executable file. You need to first add changes to the AHK file, then recompile it into a program file.)
The following is a list of corrections I added before compiling the version posted on Dropbox:
I first added the copyright and trademarks symbols (©, ®, and ™) . They are automatically converted when you enclose the corresponding letters in parentheses. I added "crème" because I would never use it without the accent. Plus, here are a few fractions:
Note that in order to distinguish when I want to use "exposé" or "résumé" rather than "expose" or "resume" respectively, I just add an asterisk to the end of the word which will covert it to the accented form. I did the same for the fractions, although they will convert instantly when the asterisk is added due to the asterisk option between the first two colons (:*:).
If for some reason AutoCorrect is changing something you don't want changed, you can usually correct it by temporarily leaving out the space or punctuation at the end of the word (the correct won't activate), then go back and add the space later.
It Works Everywhere
This AutoCorrect program should work anywhere that your keyboard works (word processors, e-mail, Web page edit boxes, Notepad, and more). If you're happy with the compiled AutoCorrect.exe program then there is no need to download AutoHotkey and learn to edit scripts. But if you want to tailor the AutoCorrect program to your work, then a little editing of the AutoCorrect.ahk file will go a long way (i.e. removing the "on accident" => "on purpose" replacement). That means learning a little AutoHotkey scripting. Once you get to know it, AutoHotkey is really not that difficult.
* * *This AutoCorrect.ahk script and others can be found at the ComputorEdge Free AutoHotkey Scripts Web Page.