Is it possible that passing the handle of the window or menubar is not working because I first must somehow convert the object into an NSObject and pass that or its ID instead?
This link uses the original string constant and has some Obj-C info:
[code]/*** Posting Notifications ***/
/* Posts a notification to accessibility client observers. Note that accessibility notifications are not NSNotifications and do not use the NSNotificationCenter mechanism. These notifications are received by client processes using the AX API defined in <HIServices/Accessibility.h> including AXUIElement.h.
For all notifications, the observer recieves the provided notification string and the AX API representation of the provided element.
For most notifications, the provided element is checked for observers of the provided notification.
For some notifications, the accessibility parent of the provided element is checked for observers instead. An example is NSAccessibilityCreatedNotification. It is impossible for a client to register to observe this notification on a new element, since the element does not exist yet. So, the function would be called passing in the new element, and the accessibility parent of the element is automatically checked for registered observers.
The following notifications check the accessibility parent of the provided element for observers: NSAccessibilityCreatedNotification, NSAccessibilityWindowCreatedNotification, NSAccessibilityDrawerCreatedNotification, NSAccessibilitySheetCreatedNotification, NSAccessibilityHelpTagCreatedNotification, NSAccessibilityRowExpandedNotification, NSAccessibilityRowCollapsedNotification.
For another set of notifications, the NSApp instance is always the observed element. An example is NSAccessibilityFocusedUIElementChangedNotification. The provided element would be the element that now has focus, and the function will automatically check NSApp for registered observers.
The following notifications always check for accessibility observers of NSApp: NSAccessibilityFocusedUIElementChangedNotification, NSAccessibilityFocusedWindowChangedNotification, NSAccessibilityMainWindowChangedNotification.
The rule of thumb is that the affected element should be passed into the function (the newly created element, the newly focused element, the row that was expanded, etc.), and the function will check for observer registrations on the correct element.