Re: Oldest Message in Mail's Trash
Re: Oldest Message in Mail's Trash
- Subject: Re: Oldest Message in Mail's Trash
- From: Luther Fuller <email@hidden>
- Date: Fri, 27 Jun 2008 12:43:51 -0500
The problem seems to be worse than yesterday's question. I wanted to
test if I could delete messages in a "TEST" mailbox by simply deleting
the last message until there were no messages to delete. Here's my
script ...
tell application "Mail"
activate
if (count message viewers) = 0 then make new message viewer
set frontViewer to (some message viewer whose index is 1)
set selected mailboxes of frontViewer to {mailbox "TEST"}
set sort column of frontViewer to date sent column
--
repeat
if (count messages of mailbox "TEST") = 0 then exit repeat
set lastMsg to (last message of mailbox "TEST")
delete lastMsg -- I also tried -- move lastMsg to mailbox "TEST"
end repeat
end tell
The first time thru the loop, 'lastMsg' is correctly deleted.
The second time thru the loop, the value of 'lastMsg' points to the
message that has just been deleted and deletes it to the trash again.
The result is that only one message is deleted and the loop does not
exit.
If I manually exit the loop, then quit-relaunch Mail, I can delete one
more message.
The problem is that even though the message visually appears in the
trash mailbox after it's deleted, the "TEST" mailbox thinks it still
contains the deleted message. Since a message should not be in two
places at the same time, this must be a bug.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden