osx - Objective-C: get menu information from external application -
I am trying to write additional applications in a Mac OS menu that displays an active menu that contains the currently active application The menu bar items are, when the user presses some hotkey, I can fix the contextual menu, but I can not currently get menu item of the active application. At the moment I get the name of the active applications to use the Update: Using a framework works great, if you are happy using 'Apple Script: < Pre> will print a list of available menus from the application's menu bar There is no way to get the relevant menu, so I do not answer it yet ... It was also helpful: You can use the menu item shown to imitate, but I'm not sure that it is possible to dynamically capture the names of all menu items. You already need to have hardcoded names in the app The issuer. [[NSWorkspace sharedWorkspace] running applications] Filtered Horizons Used:] , but NSRunningApplication contains a lot of other valuable information . Either way, can I get information about the application menu from an external application?
system events application * sevApp = [SBApplication application with bundle identifier: @ "com.apple.systemevents"]; SystemEventsProcess * proc = [[sevApp application process] objectWithName: appName]; (Proc.menuBars in SystemEventsMenuBar * menuBar) {{Menu in SystemEventsMenuBarItem * menuBaritem menu.BannerMarItems} {NSLog (@ "% @", menuBaritem.name); }}
Comments
Post a Comment