O'Reilly logo

Modding Mac OS X by Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User Interface Scripting

For whatever insane (or insanely great, if you want to be that way) reason, Apple has actually made it a lot easier and more productive to script an application’s interface than to script an application itself. User Interface Scripting (or UI Scripting, for short) is reliable and often allows you to access most of the functionality that’s supposed to be provided by traditional application scripting. For those reasons, you’re about to learn how to script interfaces before you learn how to directly script an application. For this, you’ll need the following software utilities:

Script Editor

This is the standard scripting development application. As discussed earlier in this chapter, you’ll find it in /Applications/AppleScript.

Apple’s UI Element Inspector

This barebones utility runs in a floating window. It describes interface elements at the current position of the cursor. You can download a copy of this free tool from http://www.apple.com/applescript/uiscripting/. Unfortunately, Apple regularly moves the link to the software around, and it rarely appears on the first page of the site. The most recent direct link (from the second page of uiscripting coverage) was http://www.apple.com/applescript/uiscripting/downloads/uiinspector.dmg.

PreFab’s UI Browser

This essential utility (available at http://www.prefab.com/uibrowser) complements the free UI Element Inspector, generating easy-to-use AppleScript code snippets that reference interface elements. UI Browser offers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required