Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mail Message list sort order for Applescript in ML

Hi All,


I recently upgraded from SL to ML. I'm having a few issues with an applescript i use to flag/unflag emails for later handling.

Basically, the script does the following:

- get the message list from one of the inboxes/smartboxes. These are ordered by time and grouped by thread.

- compare one message with the next one

- if some criterias are equal (thread ID, subject, ...) then the second email is unflagged

- repeat until end of list.


It was working fine in SL, as a result, i only had the first email of threads with a flag, so the others could be forgotten.


In ML, it looks like even though the emails are displayed in a specific order (date/thread), using


messages of first message viewer


does not fetch the messages in the same order, so matching cannot happen.


Is this the expected behavior in ML ? Is there anyway to have the list of messaged sorted as displayed ?


Thanks

jm

MacBook Pro, OS X Mountain Lion (10.8)

Posted on Mar 19, 2013 7:38 AM

Reply
1 reply

Mar 19, 2013 7:53 AM in response to Jean-Michel Lamotte

I found a workaround, though there must be something neater.

I added this before my script

tell application "System Events"

tell process "Mail"

tell menu bar 1

tell menu bar item "View"

tell menu "View"

tell menu item "Sort By"

tell menu "Sort By"

click menu item "Subject"

end tell

end tell

end tell

end tell

end tell

end tell

end tell


then the same except "Date" instead of "Subject".


My script does what i want now.

Mail Message list sort order for Applescript in ML

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.