AutoCorrect… for everything!

#01Microsoft Word has a very neat, at least some users think it’s very neat, autocorrect feature that can correct your words as you type.  So when you are working in Microsoft Word you can take advantage of this.

If you like this feature wouldn’t it be great if you could use it in Studio as you typed to supplement the other great features like AutoSuggest, QuickInsert etc… in fact wouldn’t it be great if you could use your autocorrect lists from Microsoft Word in any editing application you have on your computer?  If you like autocorrect then of course it would be, and I see this come up in various forums quite often.

So here’s one way to do it using an excellent application called AutoHotkey.  You can download AutoHotkey from here and it’s completely free : Download link

This application has many enthusiastic users who often provide free scripts they have compiled to use with this tool that can change your words as you type as well as many other more complex and wonderful things.  I use it everyday to get around the lack of diacritics on my English keyboard, so as I type I can be presented with a list of the available ones like this for example when I type the name of Göttingen where I live:

#02This is really handy because I can use it when I’m writing a blog article as I have here, when I’m typing into Studio, when I’m writing emails, or even when I’m writing in Word.  I can use it in any application that allows me to write text!

Now, for most of you handling diacritics simply won’t be an issue, but getting hold of that elusive autocorrect list might be.  So, here’s how you can get that list into AutoHotkey.  First of all though you might want to take a look at this ready made script from Jim Biancolo that provides an excellent start as the current version contains not only the autocorrect list (in English) but also many other types of autocorrect uses: Download link  So click on the download link and then copy and paste the file into a text editor and save it as AutoCorrect.ahk  If you take a look at this script around 10% of the way down at the section called “Common Misspellings – the main list” you’ll see the format that the simple autocorrect list you can find in MSWord needs to be in… so like this:

::avengence::a vengeance
::adbandon::abandon
::abandonned::abandoned
::aberation::aberration
::aborigene::aborigine
::abortificant::abortifacient
::abbout::about

This article is not intended to be a howto for AutoHotkey, there is plenty of help on the AutoHotkey website for that, but if you want to add your own list to this, or if your list is not in English (quite likely!) then first you need to get the list out of MSWord and then convert it to the format above.

I found two scripts (one for Word 97 – 2003, one for 2007 – 2010) that you can use to create a Word macro that will place your autocorrect list into a 38-page (for me) word document.

I have only tested this with the 2007-2010 version and this works perfectly, so please let me know if you use the 97 – 2003 version and it doesn’t!  This is what I did… I created a new macro in Microsoft Word by going to View -> Macros (Alt+F8):

#03

I then typed the name 1. AutoCorrectList (no spaces) and then clicked on 2. Create.  This opens up the editing environment, and I’m feeling very clever by this stage, where I simply copied the clever code (somebody else wrote) at the bottom of the code below this:

Sub AutoCorrectList()
'
' AutoCorrectList Macro
'
'

and before this:

End Sub

So I now have something that looks like this:

#04

Once done I save the macro and close and return to Word:

#05

That was pretty simple and I’m starting to wonder if I’m underpaid for knowing all this stuff (even if I didn’t do it myself ;-))… so all I do now is go back to View -> Macros, select the AutoCorrectList macro from the list and click on Run.  This provides me with a 38-page document containing things like this:

#06

Easy peasy!  But this still needs to get into the correct format for an AutoHotkey script, so I simply copy all of the contents on my Word file and paste it directly into Excel.  I now have two columns, with the dodgy typing on the left, and the corrected word on the right.  So I write a formula into cell C3 like this:

=CONCATENATE("::",A1,"::",B1)

Then I copy the formula down the spreadsheet until I have a column C that looks like this:

#07

Then I can copy column C into my AutoHotkey script (don’t forget you need to look at AutoHotkey and the examples to see how to create this) like this:

#08

Simple… and now when you work in any application at all you will be able to use your autocorrect lists from Microsoft Word!

If you read this article, would like to do this, and still don’t understand how after reading the autohotkey stuff I linked to, and trying to extract the autocorrect list from Word then just drop a comment below and I’ll be happy to help… and then perhaps update this article to contain whatever is missing to make this easier to follow.  The important links again are these:

Good luck!

40 comments
  1. Perry said:

    AutoHotkey is great, I’ve been using it for several years. As an addition to your post here, there is also a version that supports Unicode, which is great for those of us who work with Chinese (and other languages of course) since it allows me, for example, to save letter abbreviations that expand into Chinese characters, which is a lot faster than switching between input modes and entering the characters manually. ( http://l.autohotkey.net/ )

    Like

  2. Perry said:

    I forgot to ask: is that script for diacritics display downloadable somewhere? I have the same problem with my keyboard here in Taiwan.

    Like

  3. Perry said:

    Thanks for that link, that looks like a great collection of scripts.

    Like

  4. Your article is very helpful for me. It was difficult for me when i want to write copyright sign, currency sign etc… when i read your article it solved my all problem in writing. And i have bookmarked your page for my future use. Now it would be easy for me to Transcribe an audio file in writing format.

    Like

  5. Louis La Bonté said:

    Thanks a lot for the info.

    By the way, for those using a French version of Excel, the formula to write into column C is:
    =CONCATENER(“::”;A1;”::”;B1)

    Also, for people not familiar with Excel, here’s what you should do:
    1) Write the formula into cell C1;
    2) Right-click on cell C1, then click Copy (in French: “Copier”);
    3) Select all the other cells to populate in column C (in my case: C2 to C1901);
    4) Right-click anywhere on your selection, then click Paste (in French: “Coller”);
    5) Voilà! All the cells are “concatenated.”

    Like

  6. I found a version of the script with a slight improvement. In the words of its author:

    ;——————————————————————————
    ‘What I changed is the function which makes the user able to add new hotstrings via a GUI.

    This is what usually happens when the user wants to add a new typo correction to the script:
    1. the user selects the misspelled word
    2. presses the windows key + h (#h) which will show the GUI
    3. the user can correct the word and press OK in order to reload the script

    the next step is what I added:

    4. The selected (misspelled) word will be replaced by the corrected word

    (it will also trim the misspelled word and automatically select the second edit field in the GUI)’
    ;——————————————————————————

    It can be found here: http://www.autohotkey.com/board/topic/89909-autocorrect-script-a-bit-better/

    Michael

    Like

    • Thanks Michael, there is a great AHK community out there which makes it reasonably accessible to anyone until they get their heads around it!

      Like

  7. RiaV said:

    Thank you so much for sharing this. I have a huge AutoText list in Word that helps me expand custom abbreviations that I use all the time when I translate. Trados 2011 was driving me crazy because I lost that ability. Now, I am happily expanding my abbreviations again. I may want to put AutoKey to other good uses too. Again: Thanks a zillion.

    Like

  8. Paul Danaher said:

    Paul Biancolo wrote (back in 2006)
    “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).”
    This would be really useful, but I can’t find the script anywhere – can you help, please?

    Like

    • I wondered where you were quoting from at first, and then realised this was a quote on a website from Jim Biancolo. I googled a little and found this which seems to be the place where this script gets updated and the person mentioned by Jim is in here too – Autoreplace

      Liked by 1 person

  9. Hi Paul,

    Just applied your method to create the Spanish AutoCorrect. Anybody can downloaded the Spanish Autocorrect AutoHotkey macro from my blog here:

    http://www.gonduana.com/?p=1020
    (sorry, everthing in Spanish here)

    Also, I simplified the steps by editing a little bit the VBA code:
    ____________

    ‘ Export all Autocorrect entries to a list compatible with AutoHotkey
    Sub ListadoAutoCorreccion ()
    Dim a As AutoCorrectEntry

    For Each a In Application.AutoCorrect.Entries
    Selection.TypeText “::” & a.Name & “::” & a.Value & vbCr
    Next
    End Sub
    ____________

    This way the output form Word can be pasted direcly into an AutoHotkey script (no need to process it in Excel).

    Regards,

    … Jesús Prieto …

    Like

  10. Beijerdea #9 (taken from: http://beijerdeas.com/)

    “2015-01-07 The huge list of misspelled words in my AutoHotkey AutoCorrect script is a real time saver. I type ‘litle’, and it’s immediately replaced with ‘little’. I type ‘mkeaningless’, and instead I end up with ‘meaningless’. You get the picture. I can also quickly add new ones as I think of them (read: type them). All I need to do is highlight a misspelled word anywhere on my computer and press Win+H. A little dialogue will pop up where all I need to do is enter the correct version of the word and hit enter. The next time I mistype that same word, the correct one will be inserted instead. Furthermore, it will also be automatically inserted in the text I am writing now, so I can immediately continue where I left off. Anyway, as I said, the list is huge, but … is it huge enough or as huge as it could be? This got me thinking: could we develop a little program to generate near-endless lists of misspelled words, which we could then add to the list in the AutoCorrect script, making it even more useful? If you know of such a program, or already-created lists, please contact me at michael@beijer.uk!”

    Michael

    Like

    • Interesting idea Michael, but I’m not sure it’s a very good one. This would inevitably lead to confusion where misspelling of words could have many possible corrections so you’d probably need an autosuggest type thing to allow you to then select the appropriate one… then it’s no longer autocorrect is it? Also what would happen if one misspelling turned out to be the correct word for another? I think this type of thing is best handled as common misspellings with the ability to add to the list (or remove) easily when you think it’s appropriate.
      But just my opinion… sounds like data overload to me to generate near endless lists of misspelled words. You’ll probably also end up with misspellings nobody would ever misspell!

      Liked by 1 person

      • Louis La Bonté said:

        Indeed, the more you add autocorrect entries, the more you risk correcting words that shouldn’t.

        As an illustration, here are a few examples of contextually correct spellings that could be confused in autocorrections:
        – cant // can’t
        – discrete // discreet
        – compliant // complaint

        In the same vein, I for one also use autocorrections to accelerate the typing of words or names I use often. For instance: maffci => ministère des Affaires étrangères et du Commerce international. This one saved me a lot of time when I worked for Foreign Affairs!

        However, I have to make sure my entries will not interfere with appropriate words or acronyms. Example: I wanted to add “bcp” so that it would autocorrect as “beaucoup” (meaning “a lot” in French), but I sometimes had to use “BCP” as the acronym for “Bureau du Conseil privé” (Privy Council Office)… so I used “bcp=” instead as an autocorrect entry, leaving “BCP” untouched.

        Liked by 1 person

      • Hi Paul,

        I’m not sure what you mean by “This would inevitably lead to confusion where misspelling of words could have many possible corrections …?”. Could you give me an example?

        I just looked in the section below …

        ;——————————————————————————-
        ; Anything below this point was added to the script by the user via the Win+H hotkey.
        ;——————————————————————————-

        … in my own script, and I noticed that I added all of the following with the Win+H shortcut trick over the last year or two:

        ::transaltion::translation
        ::transaltin::translation
        ::transaliton::translation
        ::translatiton::translation
        ::translaiton::translation
        ::transdlation::translation
        ::tranalsting::translating
        ::trsnaltion::translation
        ::trasnalation::translation
        ::trandsaltion::translation
        ::trandslaiton::translation

        Wouldn’t it be useful if I could have found these programmatically, instead of having to add them manually on the fly?

        Michael

        Like

      • Hi Michael, I think Louis gave a few good examples above. Of course it would be useful to have these lists prepared for you before you start, but I just don’t think generating “near-endless lists of misspelled words” is a good idea because I think it could just as easily create more work correcting the “corrections”, especially when the possible “correction” might pass a spell check.

        Like

  11. I was exaggerating Paul 😉

    Another idea might be to generate a list of the words you yourself type the most often, and then create a list of AutoCorrections from that. Maybe a slightly more realistic goal.

    Like

  12. cynflux said:

    the correction hotkeys with apostrophes are not displaying the correct text.
    Examples:

    don’t

    don’t know

    don’t

    Like

    • That looks like an encoding issue in the environment you are working. So it’s not supporting the apostrophe you corrected to.

      Like

      • cynflux said:

        I actually did get it to work in my enviroment, but had to tweak a few things.

        For [:do’nt::don’t] to work correctly, I used the Character Map app to select a different apostrophe (U+00B4 : Acute Accent) and it seems to work now.

        For [don;t::don´t], I had to use the escape sequence `;

        Like

      • So it is encoding… interesting, and thank you for sharing that experience. I’m sure you aren’t the only one!

        Like

  13. Hacène said:

    You could do all that with only 1 macro in Word 🙂
    Something like:
    Public Sub List_AutoText_Entries_3()

    Dim AC As AutoCorrectEntry
    Dim xlApp As Excel.Application
    Set xlApp = CreateObject(“Excel.Application”)
    xlApp.Visible = True
    Dim xlWB As Excel.Workbook
    Dim MyExcelRow As Long

    Set xlWB = xlApp.Workbooks.Add
    MyExcelRow = 1
    ‘ xlWB.Activate
    xlWB.Worksheets(1).Columns(“A:A”).NumberFormat = “@”
    ‘ Selection.NumberFormat = “@”

    For Each AC In AutoCorrect.Entries
    With xlWB.Worksheets(1)
    .Cells(MyExcelRow, 1).Value = “::”&AC.Name&”::”&AC.Value
    End With
    MyExcelRow = MyExcelRow + 1
    Next
    End Sub

    This would create a new Excel workbook and copy the list directly formatted into column A of Worksheet 1. After that you are ready.

    This is the type of things explained in detail in Out of Office newsletter.

    Like

    • Interesting… but doesn’t Word have an AutoCorrect already? The point here is to get the lists out of Word and into a format you can use in any application on your computer. This won’t do that.

      Like

      • Hacène said:

        I might have been misunderstood. The code I gave you was to do at once what you did with extracting the autocorrect entries to Word, then copying those into Excel and adding a third column in Excel to get a format adaptable to AHK.
        AutoCorrect is available not only in Word, but also in Outlook. I am not a Studio user, but a DVX3, Autocorrect is also available there. This means that for the past 3 years I am not using AHK anymore.
        This being said, with the VBA, if in the VBE you go to Tools>Reference, you can add AHK and then integrate its functions into your macro(s), which means that you could write a macro to update AHK when you have added new autocorrect entries and vice-versa.
        You also have to be aware that autocorrect entries are language specific. However, rich text entries are not language specific and present an issue with AHK (or at least used to, I don’t know if this has been sorted since).

        Like

      • ok – thanks. Less of an issue for Studio these days too as autocorrect is built into the product (uses words default for all languages to start with). But still a useful tool I think for any applications which don’t have autocorrect. Thanks for the clarification.

        Like

      • Hacène said:

        It is good to know that Studio included this feature in its software. How does this fare with richtext entries?
        Also as I said, AHK could be added in the libraries and you can write macros to smooth out AutocorrectAHK entries.

        Like

      • I don’t think rich text is an issue here. Studio just takes the default for each language and I am not aware of any problems. If you have an example I can test I’ll be able to tell you if it’s ok.

        Like

      • Hacène said:

        just make an entry for H2O with the 2 in subscript format and see if this is preserved

        Like

      • That won’t work… the AHK script won’t respect that. You need something like this most likely:

        ::h2o::
        send % “H” chr(0x2082) “O”
        return

        This works in Studio and other apps.

        Like

      • Hacène said:

        Thanks for confirming. This is a drawback when working with many chemical formula. Yet AutoCorrect integration in our main CAT tool is something VERY useful.

        Like

      • Probably easier to handle this using the regex autosuggest provider in Studio. Look for the chemical formulae in the source and reproduce them, whatever they are, with a single keyboard entry.
        Will definitely have a proper look at this problem.

        Like

  14. Interesting post and discussion, but why do I need extra tools to handle Autocorrect in Studio. Is there no way to update the Autocorrect file in Studio using an Excel file or a word table or whatever. The only solution I found so far is to enter each entry manually. This is not what I expected.

    Like

    • Hello Siegfried, the first point would be this article is over three years old and was written before we had any autocorrect for Studio at all. I still really like this solution as it’s very flexible for any application at all, and not just Studio. That was the point of the article really.
      But coming back to Studio, there is an import/export but it’s not very friendly as it’s xml. However, looks pretty easy to handle in excel with a little concatenation. I might write a quick article on how to do this.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: