Simple Mail Question

I am new to applescript and have been trying to learn by writing simple scripts but I am struggling.

I want to have mail activate and then display a list of all messages sent by a particular person in the last 21 days. Though I would love to be able to write a script to do this, all I have done for now is just set up a smart mailbox to perform the function. So, at this point, I just need mail to open and select this smart mailbox.

This is what I tried to no avail:

tell application “mail”
activate
check for new mail
select mailbox “Andrea”
end tell

I also tried: find, get, choose, open, etc and several other options but nothing worked.

How do I open mail and have it simply “click” on a mailbox?

And if you want to help even further…

How do I open mail and have it display a list of messages sent by a particular person over the last 21 days?

I’ve been working on this for two days and have searched online to no avail. Your help would be greatly appreciated!!

Thanks,
Jet (newbie)

Jet:

We have a link on our links page to a bunch of Mail scripts, one of which may be exactly what you are looking for. There is a script in his bundle entitled “Open Mailbox” that sounds pretty darn close to what you are asking about. in any case, the full code is provided in each script, and you may be able to edit it to fit your needs.

Here is the link to that page:

http://homepage.mac.com/aamann/Mail_Scripts.html

And, here is the link to MacScripter’s links page (which is available via a drop down on any page of MacScripter):

http://macscripter.net/links/

Good luck

CAS

Thanks for the info.
I found an interesting work around:

tell application "Mail"
	activate
	set themailboxes to {mailbox named "MyFriend"} -- this is a list of mailboxes, {"one","two","three"}
	set mviewer to the first message viewer -- message viewer is a list, get the first one
	set selected mailboxes of mviewer to themailboxes -- display our choosen mailboxes
end tell

Jet:

Very nice. I was playing around with it a little yesterday, but made no progress. Thanks.

CAS