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

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 Using mail terms to script the Mail application
				with properties Using mail terms to script the Mail application
				{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 ...

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