|
|
AppleScripting the Keychain menu
There is a way to script the keychain menu, but it's not through the Keychain Access application. Instead, you have to go through the UI Server, which controls all of the "menu extras" menus.
Normally, you can find a particular menu extra by it's description ("iChat menu extra", for example.) However, the keychain menu extra does not register a description for itself, so if you want to access it via AppleScript, you have to do a bit more of a "kludgy" search. In this example, the script clicks on each menu extra, and looks at the first menu item. If the name of the item is "Lock Screen", then it clicks it.
Note that UI Scripting has to be enabled for this to run (System Preferences->Universal Access->Enable access for assistive devices.)
activate application "SystemUIServer" tell application "System Events" tell process "SystemUIServer" repeat with i from 1 to number of menu bar items of menu bar 1 tell menu bar item i of menu bar 1 click try if name of menu item 1 of front menu is "Lock Screen" then click menu item "Lock Screen" of front menu exit repeat end if end try end tell end repeat end tell end tell
AppleScripting the Keychain menu
I knew someone else would have worked this out for me. Excellent! |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|