Keyboard shortcut to correct spelling mistakes

keyboardspellcheckspelling

Is there any way for me to get all of the words detected by the standard OS X spelling checker as mistakes, to be corrected to the first available choice using a keyboard shortcut?

E.g. I type aqcuired and several words/sentences later I look up from the keyboard and see the typo. Instead of reaching for the mouse or tediously navigating there with the keyboard for a manual correction, I'd like to just hit some key combination and get it to be fixed to the obvious correction acquired

Any solution which is applescript based will also do, since I can easily trigger any applescript from the keyboard (using iKey).

Best Answer

I couldn't come up with anything better than this:

--delay 0.3
--activate application "TextEdit"
tell application "System Events" to tell (process 1 where frontmost is true)
    set wasshown to title of windows contains "Spelling and Grammar"
    keystroke "w" using option down
    if not wasshown then keystroke ":" using command down
    tell (window 1 where title is "Spelling and Grammar")
        delay 0.05
        try
            select row 1 of table 1 of scroll area 1
        end try
        click button "Change"
        if not wasshown then click button 1
    end tell
end tell

For the keystroke command to work, create ~/Library/Keybindings/ and save this as DefaultKeyBinding.dict:

{
    "~w" = selectWord:;
}

Other methods weren't really usable when for example the word under the caret was not underlined.

Many words don't have any suggestions. I think it's easier to just press ⌘: and retype words manually, or to press ⌘; and double-click the suggested words.

Adding changeSpelling: to DefaultKeyBinding.dict didn't seem to work.