• 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 06:46:01 -0400

On Aug 6, 2013, at 8:02 PM, Robert wrote:

> Hello Applescript List members;
>
> First time poster and relative newbie here.
>
> I've written a script that searches for messages, in a particular mailbox, that are older than a couple of days and then deletes them.
>
> The script generally works except I usually have to run it two or three times before it picks up ALL of the messages that fall into the
> 				repeat with i from 1 to messcount
> 					set theSource to item i of selectedMessages
> 					set background color of theSource to red
> 					delete theSource
> 				end repeat

This is the old "Deleting from Array" pothole that every programmer falls into.

If you have messages A,B,C,D,E in the list, then your code will
delete message 1(A) - that leaves B,C,D,E

delete message 2(C) - that leaves B,D,E

delete message 3(E) - that leaves B,D

delete message 4 - there is no message 4.


----------------------------------------------------------------
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


  • Follow-Ups:
    • Re: Delete Mail Script
      • From: 2551 <email@hidden>
References: 
 >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