Version: 1.3

Posted: 2007-02-19

Build Requirements: Mac OS X 10.4.8 and later, Xcode 2.4.1.

Runtime Requirements: Mac OS X version 10.2 and later.

View Source Code:

Download Sample (“UIElementInspector.zip”, 172.0K)
Download Sample (“UIElementInspector.dmg”, 236.1K)



Description

This sample demonstrates the use of the Accessibility API introduced in Mac OS X version 10.2.

This API provides an abstraction layer to allow accessibility applications a way to manipulate the UI of other applications, be they Carbon or Cocoa. The API is provided for use by both Carbon and Cocoa applications, although this sample demonstrates their use from a Cocoa application. In this sample, the Accessibility API is used to get information about whatever AXUIElements (widgets) are under the mouse at any given time. Information can be obtained from the AXUIElement, and actions that it has can be performed.

As the mouse moves, the inspector window displays information obtained through the new API. When you then lock the inspector window on an element, you can dig deeper into the information provided by the API for that object, as well as trigger any actions that it might provide, in the interaction window. This sample does not demonstrate how to make a custom UI element accessible so that the Accessibility API can access it. Custom Cocoa widgets will often just inherit the right behavior from their superclass. Carbon applications will typically need to provide a little more code to serve up the right information to applications that are interested. Instead, this sample shows how to use the Accessibility API itself - to get information on other applications and UI elements on the screen, which you would need to do as an accessibility application.

Version 1.1 - Update: some minor bug fixes are included in this release.

Version 1.2 - Fixed "Attributes" popup synching problem - fixed mismatch between attributes and values. Updated Xcode project for Universal Binary builds.

Document Revision History

Date Notes
2007-02-19Icon file name change: "AccessibilityInspector.icns"
2007-02-14Fixed "Attributes" popup synching problem - fixed mismatch between attributes and values. Updated Xcode project for Universal Binary builds.
2003-07-28Demonstrates using the Accessibility API introduced in Mac OS X 10.2, which allows manipulation of an application's UI.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.