1 Reply Latest reply: May 3, 2012 8:37 AM by Pierre L.
Thierry Leveque Level 1 (5 points)



Is anybody know if there is a way to switch to a particular "input source" (keyboard) with a command line? (or with Apple Script).

Not switch to the next or the previous, but to a specific one. Like switch to "Canadian French" or "Us English".





  • Pierre L. Level 5 (4,205 points)

    Hi Thierry,


    Provided the Input menu is already showing in the menu bar and contains the desired input source, the following script shoud do what you are asking for:


    set theInputSource to "Canadian French - CSA"

    tell application "System Events" to tell process "SystemUIServer"

        click (menu bar item 1 of menu bar 1 whose description is "text input")

        click menu item theInputSource of menu 1 of result

    end tell



    Since the above script uses GUI Scripting, you must enable the Accessibility Frameworks by clicking the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane.

    Message was edited by: Pierre L.