Re: selecting a message in Mail
Re: selecting a message in Mail
- Subject: Re: selecting a message in Mail
- From: Axel Luttgens <email@hidden>
- Date: Fri, 18 Sep 2009 23:38:39 +0200
Le 18 sept. 2009 à 16:07, Jim Brandt a écrit :
Is there a way to select a specific message in a mailbox
in the Mail application?
[...]
When I put:
select message m in mailbox "Inbox"
in place of the display dialog, I get this error:
Mail got an error: message 2 of mailbox "Inbox" of account
"Comcast Account" doesn't understand the select message.
In order to incorporate the piece of my currently working script,
I need to select one of these messages. Using the content of
"subj" I can isolate the message I want but can't figure out how
to select this message so I can process it. The SDEF for Mail
doesn't show a select command. Any suggestions?
[...]
Hello Jim,
You're right, there's no select command in Mail's dictionary.
Let's remember that usually, a scripting model tends to allow for the
automation of tasks otherwise performed by hand.
In this case, selecting messages happen thru a message viewer.
And, indeed, the dictionary shows:
message viewer n [inh. item] : Represents the object responsible for
managing a viewer window
elements
contains messages; contained by application.
properties
[...]
selected messages (list of message) : List of messages currently
selected
[...]
So, a message viewer has a selected messages property, and that
property seems to be a settable one.
The problem should thus be reduced to building the list of messages to
be selected.
This one works here (changing the domain of your email address, so as
to preserve the innocent):
tell application "Mail"
messages of mailbox "•Lists/applescript-users" whose sender
contains "email@hidden"
tell front message viewer to set selected messages to result
end tell
HTH,
Axel _______________________________________________
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