Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScripts to choose input method directly

According LJ user vinum advise I made AppleScripts in Automator, like this:


on run {input, parameters}


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


tell (1st menu bar item of menu bar 1 whose description is "text input") to {click, click (menu 1's menu item "Pinyin - Simplified")} --Pinyin - Simplified

end tell


return input

end run



and 2 more for Russian and English


After in System Preferences > Keyboard > Services i make Shortcuts for each input method, but its not work.


Help!!


OS X 10.9.1


User uploaded file

User uploaded file

User uploaded file

MacBook Pro with Retina display, OS X Mavericks (10.9.1)

Posted on Jan 9, 2014 1:02 AM

Reply
1 reply

Jan 10, 2014 2:08 AM in response to Andrew Mee

Hello


Couple of questions and comments.


1) Do your scripts work as expected in AppleScript Editor?


2) Do your services work as expected when run in Automator.app?


3) Do you see any error messages in Console.app when you invoke the services to fail?


4) I often see that sort of peculiar AppleScript coding which indeed gains nothing but obfuscation. I'd recommend you rewrite it as something clearer in code structure such as:


tell application "System Events"
    tell process "SystemUIServer"
        tell (menu bar 1's menu bar item 1 whose description is "text input")
            click
            tell menu 1's menu item "Pinyin - Simplified" --Pinyin - Simplified
                click
            end tell
        end tell
    end tell
end tell


5) There's new limitations on GUI scripting introduced under 10.9 as explained in the following document. I don't know whether this is relevant to your issue, though.


cf.

OS X: Using AppleScript with Accessibility and Security features in Mavericks

http://support.apple.com/kb/HT5914



Regards,

H

AppleScripts to choose input method directly

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.