• 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: Oldest Message in Mail's Trash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Oldest Message in Mail's Trash


  • Subject: Re: Oldest Message in Mail's Trash
  • From: Luther Fuller <email@hidden>
  • Date: Sat, 28 Jun 2008 16:27:27 -0500

I think I've solved my problem. My original script was ...

	tell application "Mail"
		set messageList to (messages of mailbox "????")
		count items of messageList
		if the result = 0 then
			return {}
		else if the result > 100 then
			set messageList to (items 1 thru 100 of messageList) as list
		end if
	end tell

And why, you might ask, is this script a problem? I never thought it a problem since I usually have only tens of messages in a mailbox, but on rare occasions may have hundreds of messages in a mailbox. I've read of users having thousands of messages stored in Mail, but still didn't consider this a serious problem. Then I read of user's with more than 10000 messages stored in Mail. The script, above, should still work, but it's asking for trouble.

I wanted to get the oldest 100 (at most) messages in a mailbox without getting a huge list unnecessarily. My new script is ...

tell application "Mail"
set sort column of (some message viewer whose index is 1) to date sent column
set listLen to (count messages of mailbox "????")
if listLen = 0 then return {}
if listLen > 100 then set listLen to 100
set messageList to (messages -1 thru -listLen of mailbox "????")
end tell


Seems to be working OK.

_______________________________________________
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: Oldest Message in Mail's Trash
      • From: Michelle Steiner <email@hidden>
References: 
 >Oldest Message in Mail's Trash (From: Luther Fuller <email@hidden>)
 >Re: Oldest Message in Mail's Trash (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: PhotoShop Spot Channels
  • Next by Date: Re: Oldest Message in Mail's Trash
  • Previous by thread: Re: Oldest Message in Mail's Trash
  • Next by thread: Re: Oldest Message in Mail's Trash
  • Index(es):
    • Date
    • Thread