Amateur question: Mail scripting

I’m trying to learn how to Applescript. I want to create a script that will check my Mail
for new and unread messages. I’ll later try to script this into something that will cross-reference the senders with people in my Address Book and return only new, unread messages from people in my Address Book.

My question: setting a variable called newMessages to messages whose read status is “?”. I don’t know what Mail will recognize as the boolean value for read status. Is it “true” for unread messages? Is it “unread” for unread messages?

How do I find out what the values are that I can enter for similar properties of applications?

Thank you for any replies.

You can learn a lot about an applications scripting abilities by looking at each scriptable applications dictionary. If you are using Panther (Mac OS X 10.3) there is a “Library” Palette that opens via the “Window” menu in the Script Editor. You can also drag and drop and applications icon onto the Script Editors icon to open it’s dictionary.

In Mail.apps dictionary, there is…

read status  boolean  -- Indicates whether the message is read or not

Apple provides a script that should help you out, it’s name is “Count Messages in All Mailboxes.scpt” and it’s in the Mail Scripts folder via /Library/Scripts/Mail Scripts.