Skip to content

Instantly share code, notes, and snippets.

@sidkang
Last active November 1, 2021 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidkang/3869f1c70b695ac2e6ede2d363911058 to your computer and use it in GitHub Desktop.
Save sidkang/3869f1c70b695ac2e6ede2d363911058 to your computer and use it in GitHub Desktop.
change IME using AppleScript
launch application "System Events"
delay 0.1
ignoring application responses
tell application "System Events" to tell process "TextInputMenuAgent"
click menu bar item 1 of menu bar 2
end tell
end ignoring
do shell script "killall 'System Events'"
delay 0.1
tell application "System Events"
tell process "TextInputMenuAgent"
tell menu bar item 1 of menu bar 2
click menu item "ABC" of menu 1
delay 0.1
end tell
end tell
end tell
ignoring application responses
tell application "System Events" to tell process "TextInputMenuAgent"
click menu bar item 1 of menu bar 2
end tell
end ignoring
do shell script "killall 'System Events'"
delay 0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment