I have an OS X application that runs as a status bar app. I am trying to do a test automation. Is there a way to click the status bar app using Apple Script?
The script given below works only on native apps.
tell application "System Events" to tell process "SystemUIServer" to click menu bar item 1 of menu bar 1
I am looking for a similar functionality on custom apps.
Not all Menu Bar Extras (or status icons) can be accessed through UI Scripting. You have to experiment with whether they can be called through a unique description or other value. Play with code like this to see if you can figure it out:
tell application "System Events" to tell process "SystemUIServer"
tell (menu bar item 1 of menu bar 1 where description is "clock")
click
click menu item "Open Date & Time Preferences…" of menu 1
end tell
end tell
If you can't find it there, you can try menu bar 2 for Status items.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With