Skip to content

Instantly share code, notes, and snippets.

@seungjin
Created October 16, 2014 08:21
Show Gist options
  • Save seungjin/4d46c77acc13b0c3b66b to your computer and use it in GitHub Desktop.
Save seungjin/4d46c77acc13b0c3b66b to your computer and use it in GitHub Desktop.
applescript that change your keyboad input type
on changeKeyboardInput(language)
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
click menu item language of menu 1 of result
end tell
end changeKeyboardInput
on run argv
if item 1 of argv = "en" then
changeKeyboardInput("U.S.")
else if item 1 of argv = "kr" then
changeKeyboardInput("2-Set Korean")
else if item 1 of argv = "cn" then
changeKeyboardInput("Pinyin - Simplified")
else
display dialog "Language not defined!"
end if
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment