• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AppleScript-Users Digest, Vol 5, Issue 391
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: AppleScript-Users Digest, Vol 5, Issue 391
      • From: Luther Fuller <email@hidden>
  • Prev by Date: Re: Oldest Message in Mail's Trash
  • Next by Date: Re: AppleScript-Users Digest, Vol 5, Issue 391
  • Previous by thread: Re: Meta data help
  • Next by thread: Re: AppleScript-Users Digest, Vol 5, Issue 391
  • Index(es):
    • Date
    • Thread