Hotkey switching between spelling dictionaries

keyboardspellcheckspelling

I'm often using 4 languages for writing texts. Now, each time switching languages with:

  • +:
  • and changing the language in the popup

Is possible somewhat /applescript, shell-script, anyhow :)/ define a global hotkey for my 4 languages? Something like

  • +alt++1 – selects English
  • +alt++2 – selects Czech
  • etc..

Ps: and no, the automatic language detection maybe works for few languages, but not for me.. 🙁

Best Answer

You could assign shortcuts to scripts like this:

tell application "System Events" to tell (process 1 where frontmost is true)
    set shown to title of windows contains "Spelling and Grammar"
    if not shown then keystroke ":" using command down
    tell (window 1 where title is "Spelling and Grammar")
        delay 0.1
        tell pop up button 1
            click
            click UI element "Deutsch" of menu 1
        end tell
        if not shown then click button 1
    end tell
end tell

It's probably not possible to use the setLanguage: method in NSSpellChecker in DefaultKeyBinding.dict.