Re: Combining NSAccessibility and AX APIs
Re: Combining NSAccessibility and AX APIs
- Subject: Re: Combining NSAccessibility and AX APIs
- From: Christiaan Hofman <email@hidden>
- Date: Sun, 11 Oct 2009 00:13:42 +0200
On Oct 10, 2009, at 23:55, Martin Pilkington wrote: Hey,
I'm wanting to write code that will drive another application via the accessibility APIs. Now to make things simpler for myself I'm wanting to wrap this in Cocoa APIs. NSAccessibility provides 99% of what I need, but doesn't seem to provide a way to get the AXApplication of another item. I'm hoping to take an approach where I have an object that represents a UI element and contains an AXUIElement, which will then implement NSAccessibility (mostly because the API is already there and so I don't have to invent my own) which will call the appropriate.
Now that is the bit that's obvious to me, what isn't so obvious is how well the various other parts of NSAccessibility interact with the C based AX APIs. Would I be right in assuming that all the string constants for notifications, attributes, roles etc in NSAccessibility are the exact same constants as defined in the AX APIs and so I can use them interchangeably due to toll free bridging? And when dealing with notifications, if my objects add themselves as observers to NSNotificationCenter, when I receive a notification via the AX APIs can I use NSAccessibilityPostNotification() to then forward that to the notification center observers?
Thanks
--------------------------------- Martin Pilkington Writer of Weird Symbols
No you can't assume any of this. If it is true, that's an implementation detail you shouldn't rely on. Moreover, NSNotificationCenter does not notify outside the process.
NSAccessibility should be used to implement the accessibility in the accessible app, while the AX C-API should be used to access and control the accessibility from outside the app. That's how it works, everything else is not supported. Internally, the AX API will certainly use NSAccessibility API to access the information, but how it does that is private. It certainly will also involve various checks, as well as some inter-process communication. For you to circumvent any of that would be an abuse and could be potentially dangerous.
Christiaan
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden