Exploring the Mail Application Object
Mail has an application scripting
object that represents the Mail app itself. You can get this
object’s properties with an AppleScript, such as the
user’s email address (property user email), the
software’s version, and a
true
/false
property called
frontmost
(representing whether or not Mail is the
frontmost program on the Mac OS X desktop ).
Example 33-2 gets the value of some of these properties and displays them to the user, using the display dialog scripting addition.
Tip
All the Standard Additions osax are available for AppleScript on Mac OS X, with a few variations compared with OS 9. Appendix A, describes these variations.
tell application "Mail" set myemail to user email set appname to name set mver to version end tell display dialog ("the user's email is: " & myemail & return & "the App name is:" & appname & (ASCII character 13) & "the App version is: " & (mver as string))
Get AppleScript in a Nutshell 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.