Re: Applying a Script to a Mail message
Re: Applying a Script to a Mail message
- Subject: Re: Applying a Script to a Mail message
- From: Rob Jorgensen <email@hidden>
- Date: Fri, 21 Feb 2003 21:46:20 -0500
At 1:16 PM +1100 2/22/03, Tim Mansour wrote:
Has anyone tried using the feature in Mail to apply an AppleScript
to an incoming message, as part of a rule?
My question is: how does the script know which message to work with?
Is a reference to the message passed to the script as a parameter?
Or should the script refer to the "current message" or something
similar? Any suggestions welcome.
Here's some info from a member of Mail's development team that might be useful
-- Rob
At 10:52 AM -0800 2/7/03, cricket wrote:
The need to be compiled scripts. The location doesn't matter, as
long as you don't move the script after you have attached it to a
Mail rule. They are currently stored as paths to the script, so
moving it would cause the rule to silently fail. They don't need a
special file extension.
It's not well documented right now, but we plan to update the Mail
Help documentation in the next update and hopefully post a tech
note. A simple script such as this would display a dialog:
on perform_mail_action(info)
display dialog "Hi!"
end perform_mail_action
To verify it works, create a rule, put it first in your rule list,
make the condition 'every message', attach the applescript, select
any message and choose 'Apply Rules To Selection' from the Message
menu. One thing to keep in mind is that any rule that does a
transfer ends further evaluation on a message, so that could be why
the script isn't getting triggered.
A more interesting example is this:
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
Hope that helps,
- cricket
----->
Software Entomologist - Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
_______________________________________________
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.