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:
This is the standard scripting development application. As discussed earlier in this chapter, you’ll find it in /Applications/AppleScript.
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.
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 ...