DekGenius.com
[ Team LiB ] Previous Section Next Section

22.1 Getting Started with Accessibility

If you want to script the unscriptable, you must first open System Preferences to the Universal Access pane and make sure that the "Enable access for assistive devices" checkbox is checked. This step is absolutely crucial, since the checkbox is unchecked by default; unless it is checked, the scripts in this chapter will fail (with a mysterious error message, of course).

You will now be able to use GUI scripting, by way of classes and events implemented in System Events, in the Processes Suite; here you'll see events such as click and keystroke and classes such as radio button and menu item. The classes in question are all UI element subclasses.

Given a particular task you'd like to perform in a particular application by means of the user interface, the problem is now to express the referenced interface elements in terms of the UI element object model. This is much the same problem that you always face with AppleScript—working out the target application's object model (see Chapter 3, and Section 19.3.5.3). But now there's an added twist, because the object model terminology within one application (System Events) must be used to express object relationships within another (the target application). There are various approaches that can help you:

    [ Team LiB ] Previous Section Next Section