Re: Modifying incoming mail subject
Re: Modifying incoming mail subject
- Subject: Re: Modifying incoming mail subject
- From: Michaël Grünewald <email@hidden>
- Date: Fri, 28 Dec 2007 18:45:54 +0100
Le 28 déc. 07 à 04:07, Mark J. Reed a écrit :
What are you setting "theMessages" to?
And you might consider using "display dialog" instead of "say", unless
of course you chose the latter due to a visual impairment.
I have used `say' because the Applescript's introduction introduce it
simultaneously as `log' and presents them as deserving a common use.
I find the dialog alternative much more pleasant!
The code I have posted here is a mere patch of lines found here and
there. In order to understand it, I relied on the following bits of
documentation:
-- DOKU
perform mail action with messages v : Script handler invoked by rules
and menus that execute AppleScripts. The direct parameter of this
handler is a list of messages being acted upon.
perform mail action with messages list of message : the message being
acted upon
[in mailboxes mailbox] : If the script is being executed by the user
selecting an item in the scripts menu, this argument will specify the
mailboxes that are currently selected. Otherwise it will not be
specified.
[for rule rule] : If the script is being executed by a rule action,
this argument will be the rule being invoked. Otherwise it will not
be specified.
-- DOKU
The previous excerpt can be found in Mail app's dictionary.
As far as I understand this, the the parameter referred to as
`theMessages' in my code is set by the party calling the script; but
I maybe misunderstand the first paragraph of the reproduced excerpt.
-- SCRIPT
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
say "Hello"
set text item delimiters to "[Caml-list] "
repeat with eachMessage in theMessages
say "This goes on and on"
set theSubject to the subject of eachMessage
set theAnswer to ""
repeat with thePart in text items of theSubject
set theAnswer to theAnswer & thePart
end repeat
set subject of eachMessage to (theAnswer)
end repeat
end tell
end perform mail action with messages
end using terms from
-- SCRIPT
Cheers,
Micha
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden