How can I reach another application's mainmenu?

Wanting to test an idea for a visually impaired friend, I would like to reach another application's mainmenu.

I wrote a very short program (Mainmenu) to test the said idea. The applicationDidFinishLaunching method is as simple as this:

Code Block
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// log this app mainmenu
for (NSMenuItem *item in [[NSApp mainMenu] itemArray]) { NSLog(@"\t<%@>",[item title]); }
// setting up method to get notified when an app becoming active
NSNotificationCenter *allApplicationsNotificationCenter;
allApplicationsNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
// Wait for applications to be launched
[allApplicationsNotificationCenter addObserver:self
selector:@selector(applicationActivated:)
name:NSWorkspaceDidActivateApplicationNotification object:nil];
}


The application starts by logging the app's mainmenu and then waits for another app to get activated. Upon launching, I get this output:

Mainmenu
File
Edit
Format
View
Window
Help

In order to print this mainmenu, I use Mainmenu's NSApplication singleton via the NSApp global variable.

The applicationActivated method called is as below:

Code Block
- (void)applicationActivated:(NSNotification *)aNtfctn {
NSRunningApplication * rnnngApplctn = [[aNtfctn userInfo] valueForKey:NSWorkspaceApplicationKey];
NSLog(@"\t\t%@",[rnnngApplctn localizedName]);
}

Switching to other applications, I get output like this:

Finder

Xcode

Menum

At this point, applicationActivated is following every activated application. The method is receiving an NSRunningApplication object from the followed applications.

I just don't know how to reach the NSApplication singleton of those external applications in order to reach their mainMenu.

I read many classes documentation and technologies (like Accessibility). I'm wondering if my way to another app's mainmenu is through using an URL to open an app bundle associated with the NSRunningApplication object received. If so, I wonder how to get the NSApplication singleton.

In other words, I don't know what to do next. Can you point me in the right direction ?
How can I reach another application's mainmenu?
 
 
Q