Re: selecting a message in Mail
Re: selecting a message in Mail
- Subject: Re: selecting a message in Mail
- From: Jim Brandt <email@hidden>
- Date: Sat, 19 Sep 2009 16:56:15 -0500
Chris,
Thanks to both you and Alex with the hints on the message viewer,
I managed to get this to work last night:
tell application "Mail"
tell front message viewer
set in_box to messages in inbox
set mcount to count of in_box
repeat with m from 1 to mcount
set ThisMess to item m of in_box
set read_status to read status of ThisMess
set subj to subject of ThisMess
set this_id to id of ThisMess
if not read_status then
if subj begins with "Applescript-" or subj begins with ¬
"MACSCRPT " or subj begins with "TidBits" then
(messages in inbox whose id is this_id)
set selected messages to result
my Save_and_Move()
end if
end if
end repeat
end tell -- message viewer 1
end tell -- Mail
The Save_and Move handler saves the message and moves it to
another mailbox and marks it as read.
Thanks to both of you for pointing me in the right direction.
Jim
On Sep 19, 2009, at 12:33 PM, Christopher Stone wrote:
On Sep 18, 2009, at 20:15, Jim Brandt wrote:
OK, I'll look into the Message Viewer.
______________________________________________________________________
Hey Jim,
An example:
tell application "Mail"
tell message viewer 1
set selected messages to every message of inbox
end tell
end tell
Ordinarily you would not do this in a script that processes
messages. You would do something more like:
set mFilter to "Apple Mail"
set mFilterList to {}
tell application "Mail"
set mList to every message of inbox
repeat with msg in mList
tell msg
try
if (get content of header "X-Mailer") contains mFilter then
set end of mFilterList to contents of msg
end if
end try
end tell
end repeat
end tell
mFilterList -- move messages to some mailbox
Unfortunately there still seems to be bug in scripting Mail's
forward/redirect/reply/ mechanism.
--
Best Regards,
Chris
_______________________________________________
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