Re: Deleting Message in Mail.app
Re: Deleting Message in Mail.app
- Subject: Re: Deleting Message in Mail.app
- From: Christopher Nebel <email@hidden>
- Date: Tue, 1 Feb 2005 13:55:15 -0800
On Feb 1, 2005, at 1:37 PM, Michelle Steiner wrote:
On Feb 1, 2005, at 12:48 PM, Courtney Braafhart wrote:
I would like a script that deletes messages that are older then a
certain date. I am having difficulty scripting the basic delete
message command. Does anyone have any suggestions? Below is an
example of what I am trying to do...script editor does not like the
"delete message" part of the script.....
Here's what I came up with. I haven't tried the delete part because I
don't want to delete any mail from my system.
set today to current date
tell application "Mail"
repeat with this_Mailbox in mailboxes
set foo to (messages of this_Mailbox whose (date received) ¬
is less than today - (365 * days) * 3) as list
-- three years
repeat with a in foo
delete a
end repeat
end repeat
end tell
I know that this script works:
tell application "Mail"
set foo to the selection as list
delete item 1 of foo
end tell
Theoretically, you should be able to simply say "delete messages of
this_Mailbox whose date received is less than ...", with no loop
necessary. Like Michelle, I haven't tried it, and for much the same
reason. :-)
Alternatively, you could wait until Tiger ships and use a smart mailbox
to do this -- see <http://www.apple.com/macosx/tiger/mail.html>. (This
isn't a very serious suggestion, but the smart folders *are* nifty.)
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden