• 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: Delete Mail Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete Mail Script


  • Subject: Re: Delete Mail Script
  • From: Steve Bird <email@hidden>
  • Date: Wed, 07 Aug 2013 20:00:20 -0400

On Aug 7, 2013, at 12:30 PM, Robert wrote:

> Hello Jean;
>
> I've never 'studied' programming so it took me a while to work out what you meant.
> With the help of yourself, 'Santa' & 'Steve Bird' I'm getting a better understanding of what may be happening here.

The basic problem is that element 4 isn't element 4 any more, after you delete element 2.

As I said, this is an old pothole that every programmer has fallen into, regardless of language.

Two ways around it:

A)  Delete items in REVERSE ORDER.  If element 5 is the last one you want to delete then it doesn't matter if the elements after 5 change numbers.

B)  Delete item I - #Deleted Items.  i.e. if you want to delete elements 1,3 and 4, the INDEXES you want to use are 1-0, 3-1, and 4-2.

That accounts for the fact that items shift down.

Which one you use depends on your particular situation.  Since you want to delete all the ones in your list, in Applescript, it may be easiest to use DOWNTO and delete them in reverse order.

Or maybe "delete EVERY message in MessageList" will do it for you.

----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com                     (toll free) 1-877-676-8175



 _______________________________________________
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


References: 
 >Delete Mail Script (From: Robert <email@hidden>)
 >Re: Delete Mail Script (From: Jean Suisse <email@hidden>)
 >Re: Delete Mail Script (From: Robert <email@hidden>)

  • Prev by Date: Re: Delete Mail Script
  • Next by Date: Re: Delete Mail Script
  • Previous by thread: Re: Delete Mail Script
  • Next by thread: Re: Delete Mail Script
  • Index(es):
    • Date
    • Thread