Re: Running external script from Mail.app
Re: Running external script from Mail.app
- Subject: Re: Running external script from Mail.app
- From: cricket <email@hidden>
- Date: Thu, 13 Mar 2003 11:05:33 -0800
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).
On Thursday, March 13, 2003, at 8:52 AM, Mike wrote:
I am unable to run an external script using rules in Mail.app. Can
anyone
confirm that mail.app will run an external scrip upon receiving a rule
trigger?
My script runs appropriately when launched as an application or run
from
within script editor however nothing happens when I set the script to
run as
an action within a rule definition. I have color conditions set in
the rule
and that responds correctly so I know the rule is activating....it just
won't run the script
Regards, Mike
_______________________________________________
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
---------->
Hamster to mouth = peer to peer
_______________________________________________
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.