General Application Scripting
When applied correctly, application scripting extends programming into the actual semantics of a given application. The scripting terminology files created by the application developer open up internal data structures and reveal commands for third-party control. Certainly, it’s more appropriate to talk about “recipients,” “subjects,” and “messages,” rather than text 1 of data item 5 of window 2
, when working with mail. Fortunately, this is possible by scripting definition files. Example 9-9 demonstrates the appropriateness of addresses and names for communicating with Apple’s Mail application.
Example 9-9. Using mail terms to script the Mail application
tell application "Mail" set new_msg to make new outgoing message tell new_msg set the visible of it to true make new to recipient at the end of every to recipient with properties {address:"noone@nowhere.org", name:"Mr. Fred Noone"} set the subject to "This is a Test" set the content to "Please disregard this message" end tell end tell
The commands you use and the data you access will, of course, vary by application. As you discovered earlier in this chapter, each ...
Get Modding Mac OS X now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.