• 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
Getting Next and Previous Messages in Apple Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting Next and Previous Messages in Apple Mail


  • Subject: Getting Next and Previous Messages in Apple Mail
  • From: Adam Tow <email@hidden>
  • Date: Sun, 22 May 2005 12:16:13 -0700

Everyone:

Is there a way to select the next or previous message in Apple Mail based on the current sort in a message viewer? It would seem that Mail defaults to date received descending when using the before/after modifier. For instance:

tell application "Mail"
    set vViewer to front message viewer
    set index of vViewer to 1

    tell vViewer
        set visibleMsgs to visible messages of vViewer
        set selectedMsgs to selected messages

        set lastItem to last item in selectedMsgs
        set beforeItem to message before lastItem

        return subject of beforeItem
    end tell
end tell

It doesn't matter if the message viewer is sorted by date ascending, subject, from, etc., the script still returns the next/previous message based on date descending. I can't seem to use:

    set beforeItem to message before lastItem in visibleMsgs
    set beforeItem to message before lastItem in selectedMsgs

Of course, I could iterate through the every message in the list, but that takes a long time when you have lots of messages in a mailbox.

Does anyone know of an alternate way to get the next/previous message in the message viewer based on the current sort parameters?

Thanks!

-adam

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Working with big lists
  • Next by Date: Re: Working with big lists
  • Previous by thread: Re: How to set a "text item"
  • Next by thread: Re: Getting Next and Previous Messages in Apple Mail
  • Index(es):
    • Date
    • Thread