Team LiB   Previous Section   Next Section

33.2 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.

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.

Example 33-2. Query the Mail Application Object
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))
    Team LiB   Previous Section   Next Section