Re: applescript in Mail.app
Re: applescript in Mail.app
- Subject: Re: applescript in Mail.app
- From: Mike <email@hidden>
- Date: Thu, 13 Mar 2003 10:32:07 -0700
Thanks for the reply cricket but I still don't understand the concept. I
don't want to do anything with the message being received, I have an stand
alone applescript crafted from one of the Apple examples to create a new
mail message. This applescript launches Safari, loads a default homepage,
copies the title and text of a local.machine default webpage to a new Mail
message and sends it to a web email address for remote retrieval. When I
run the "sendWebPage" script, it performs as expected. Now, I want Mail.app
to execute the script when the rule evaluates the subject line and matches
the appropriate text. That is where I am hung up.....the rule doesn't run
the external script. Maybe I am asking the impossible. I don't have a lot
of experience writing applescripts but have been pretty successful in
modifying examples from sources like this list to do my bidding.
Thanks again for your help.
Mike
>
From: cricket <email@hidden>
>
Subject: Re: running applescripts from Mail
>
Date: Wed, 12 Mar 2003 12:49:48 -0800
>
To: email@hidden
>
>
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 Tuesday, March 11, 2003, at 11:11 PM, Mike wrote:
>
>
> Are there any special conditions that apply to the OS X Mail program to
>
> get it to run an applescript.
_______________________________________________
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.