Chapter 9. Basic Application Scripting

Bill of Materials
Mac OS X Software
Script Editor (/Applications/AppleScript)
System Preferences (/Applications)
Terminal (/Applications/Utilities)
Calculator (/Applications)
TextEdit (/Applications)
Address Book (/Applications)
iDVD 4 (/Applications; part of iLife ‘o4)
Apple’s UI Element Inspector (http://www.apple.com/applescript/uiscripting)
iChat (/Applications)
Safari (/Applications)
Third-Party Software
PreFab’s UI Browser (http://www.prefab.com/uibrowser)
Application scripting provides, at once, both the most empowering and the most frustrating of challenges available to any application modder. Applying AppleScript to an application isn’t entirely like other programming work. It’s not enough to conceptualize the task you want to do and then lay out the actions that perform that task. There aren’t sets of basic objects and operations that work consistently time after time. And to make matters worse, a command that works with one application may not work with another.
Instead, you must wiggle into the application developer’s mindset and discover how application-scripting hooks were added to the program. You need to use those hooks to open up an application’s world of possibility. That means you’ll have to spend a good deal of time applying a trial-and-error approach to deconstructing the application’s scripting interface. The rewards, however, are ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access