• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 9. Basic Application Scripting > User Interface Scripting

9.4. 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 a free 30-day trial period, after which it costs a fairly steep $55. However, compared to the time and aggravation you'd otherwise incur, it's well worth the price to anyone who scripts applications on a regular basis. Here, you're paying for the convenience of the scripting results. Unlike UI Browser, Apple's free UI Element Inspector utility provides no usable output.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint