I'm trying to access the menu of an NSRunningApplication
object in OS X. it has an ownsMenuBar
@property, however no instance of an actual menu bar (which makes sense). I'm curious, instead, how to get access to that menu-bar that NSRunningApplication
knows of when one exists. KVO perhaps? Is there any (even small) relationship between an NSRunningApplication
and an NSApplication
?
Thanks!
-----edit------
djai djan, you've been super helpful and here is the code i've managed to make work from your suggestions!
tell application "System Events"
return menu bar of first process where frontmost is true
end tell
no relationship between NSRunningApplication
and NSApplication
BUT you can get it via applescript (which you can bridge to cocoa) requires UI scripting
the script is e.g.:
tell application "System Events"
set m to menu bar 1 of application process "Notification Center"
end tell
see: https://developer.apple.com/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/index.html