Mail + Applescript in 10.2.3
Mail + Applescript in 10.2.3
- Subject: Mail + Applescript in 10.2.3
- From: cricket <email@hidden>
- Date: Mon, 23 Dec 2002 14:23:36 -0800
Some more detailed info on the changes to the Applescript functionality
in Mail comes in the 10.2.3 update:
1. There is now a rule action for executing Applescripts
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).
2. You can now target the main viewer window ('message viewer') with
Applescript commands
Elements:
window by name, by numeric index, before/after another element, as a
range of elements, satisfying a test, by ID
Properties:
<Inheritance> item [r/o] -- All of the properties of the superclass.
focused messages list -- List of messages currently being displayed
in the viewer
drawer is visible boolean -- Controls whether the mailbox drawer is
open or not
sort column number column/attachments column/flags column/mailbox
column/message status column/subject column/from column/size
column/date sent column/buddy availability column/message color/to
column/date received column -- The column that is currently sorted in
the viewer
selected mailboxes list -- List of mailboxes currently selected in
the drawer
id integer [r/o] -- The unique identifier of the message
preview pane is visible boolean -- Controls whether the preview pane
of the message viewer window is visible or not
sorted ascending boolean -- Whether the viewer is sorted ascending
or not
selected messages list -- List of messages currently selected
all messages list [r/o] -- List of all messages in the message list
of a viewer
visible columns anything -- List of columns that are visible. The
subject column and the message status column will always be visible
(regardless of whether they are included in the list when being set
3. You will no longer be warned when sending an Applescript using Mail
Previously, a warning dialog would come up the first time (per launch)
that an Applescript that tries to send email was executed. This dialog
has been removed.
4. Some bug fixes
Feedback from this list has helped prioritize our Applescript work, so
many thanks from everyone who provided it.
- cricket
----->
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.
_______________________________________________
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.