Re: AppleScript-Users Digest, Vol 5, Issue 391
Re: AppleScript-Users Digest, Vol 5, Issue 391
- Subject: Re: AppleScript-Users Digest, Vol 5, Issue 391
- From: "Stockly, Ed" <email@hidden>
- Date: Fri, 27 Jun 2008 11:12:38 -0700
- Thread-topic: AppleScript-Users Digest, Vol 5, Issue 391
> 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.
>
It may be less than optimum behavior, but it may not be a bug. Remember that
the scripting interface is a secondary interface, and the GUI is primary. If
the program was designed so that a message moved to the trash is still
considered in a mail box for the purposes of the user interface, then the
scripting interface must cope with it. That's the nature of the business we
have chosen.
Here's how I would cope:
Set myListOfMessages to every message of myMailbox
Set myListOfMessages to the reverse of myListOfMessages
Repeat with thisMessage in myListOfMessages
Delete thisMessage
End repeat
Or
repeat with x from (count messages of mailbox "TEST") to 1 by -1
set lastMsg to (message x of mailbox "TEST")
Delete lastMsg
End repeat
HTH,
ES
_______________________________________________
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