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

Delete Mail Script


  • Subject: Delete Mail Script
  • From: Robert <email@hidden>
  • Date: Wed, 07 Aug 2013 03:56:11 +0100

Hello Santa;

I ran the script again with your amended line on a 'test' mailbox.

repeat with i from messcount to 1 by -1

It picked up all the relevant messages every time.

I noticed one anomaly though that probably has nothing to do with the changes you suggested.

The 'test' mailbox I used contained about 6000 messages going back to 2008.
If I set the script to select old messages that may total 2 or 3 thousand messages in all the script would never complete.
It looks like it just fails with no indication or error.

Limiting the message selection to around a thousand messages and things work as they should.

If I'm hitting some Applescript limit somewhere shouldn't it warn me somehow ?

Thanks once again.

Robert.



On 7 Aug 2013, at 01:35, Brian Christmas <email@hidden> wrote:

G'day Robert

Try this and see if there's any difference

Regards

Santa

tell application "Mail"
set fetches automatically to false
set selectedMessages to (messages of mailbox "Spam Virus Mail" of mailbox "Personal" whose date received is less than today - (2 * days))
set messcount to (count of selectedMessages)
if (count of selectedMessages) is equal to 0 then
tell application "Finder"
activate
display alert "No mail in the Spam Virus Mail mailbox is older than 2 days" message "Try running this script later on. Rob." giving up after 2
end tell
else
try
repeat with i from messcount to 1 by -1
set theSource to item i of selectedMessages
set background color of theSource to red
delete theSource
end repeat
end try
end if
end tell

 _______________________________________________
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: Brian Christmas <email@hidden>
    • Re: Delete Mail Script
      • From: Brian Christmas <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