I want to create an AppleScript to click a menu but I can't what ever the script I using, here is the menu I want :
ELEMENT :
Role : menu item
Title: "sign in As..."
Description :
Help:
Application: SytemUIServer
ELEMENT PATCH (starting at leaf element):
menu Item "Sign in As..." (menu item 12)
menu (menu 1)
menu extra (menu bar item 2)
menu bar (menu bar 1)
application "SystemUIServer"
So I did a few script, the last one was
ignoring application responses
tell application "System Events" to tell process "SystemUIServer"
click menu bar item 2 of menu bar 1
end tell
end ignoring
do shell script "killall System\\ Events"
delay 0.1
tell application "System Events" to tell process "SystemUIServer"
tell menu item 12 of menu 1 of menu bar item 2 of menu bar 1
click
end tell
end tell
Also I just realise that the position can change (some time the item I want to click is menu item 12 sometime its 10 etc.)