Keyboard shortcut to correct spelling mistakes
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.