Re: Mail Rule Triggered Script
Re: Mail Rule Triggered Script
- Subject: Re: Mail Rule Triggered Script
- From: "Michael P. Wilson" <email@hidden>
- Date: Tue, 25 Feb 2003 17:24:57 -0500
cricket,
I found your post in the archives just in time. (I think you answered
this question a couple weeks ago. But I had trouble getting in to the
list archives.)
Where can I find a bit more information on that |Somethingorother|
syntax? This is the first time I'm seeing that.
As an afterthought: Is it possible within this context to nab the whole
plaintext mbox format of the message in this context, headers and all?
I'd like to use this as a trigger to inject arbitrarily complex levels
of processing into the rule system and that would help immeasurably.
Thanks very much, this cracks a major impass in an application of mine.
- Mike
On Tuesday, Feb 25, 2003, at 16:34 America/New_York, cricket wrote:
This should hopefully get you started. You need 10.2.3 for this to
work.
You can attach an ordinary Applescript as a rule action, or write a
script that uses the 'perform_mail_action' handler if you want to
access the messages that matched the rule or the rule object itself:
Example:
on perform_mail_action(info)
tell application "Mail"
set selectedMessages to |SelectedMessages| of info
set theRule to |Rule| of info
repeat with eachMessage in selectedMessages
set theSubject to subject of eachMessage
set theRuleName to name of theRule
set theText to "The rule named '" & theRuleName & "' matched this
message:" & return & return & "Subject: " & theSubject
display dialog theText
end repeat
end tell
end perform_mail_action
In the example, 'info' is an Applescript record with two keys:
|SelectedMessages| and |Rule|. |SelectedMessages| is a list of message
objects that match the conditions for the rule. As messages are
fetched and evaluated in batches, this list may contain more than one
message, so be sure to take that into account. |Rule| is the rule
object that triggered the script action. (Note: We hope to have a
Scripts menu in Mail for the next major release of Mac OS X, which
will extend the perform_mail_action handler to also act on selected
messages).
- cricket
On Monday, February 24, 2003, at 19:48PM, Michael P. Wilson wrote:
Afternoon everyone,
I just read through "that" entire thread and... well, and nothing.
I seem to be having some difficulty getting a script to run as an
action of a rule trigger in Mail.
The most distilled case I can (think to) get is having a normal
mail-sorting rule (move on from address) and I added a script
execution action. So there's a move message action and the script
execution. The message moves (so I know the rule criteria are
accurate.)
The script is a one-liner:
display dialog "Hello World"
Any hints?
Thanks in advance,
- Mike
-
"Thus nature has no love for solitude, and always leans, as it were,
on some support; and the sweetest support is found in the most
intimate friendship." - Cicero
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
----->
Software Entomologist Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
---------->
Perfection (in design) is achieved not when there is nothing more to
add, but rather when there is nothing more to take away.
-
"Thus nature has no love for solitude, and always leans, as it were, on
some support; and the sweetest support is found in the most intimate
friendship." - Cicero
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.