Mail - making a new rule
Mail - making a new rule
- Subject: Mail - making a new rule
- From: John Delacour <email@hidden>
- Date: Thu, 14 Aug 2003 01:45:40 +0100
The bloody list software removed the x-flowed from this message. I
sent a Bcc to myself and the line-wrapping was faultless. I really
think Apple like to make things as difficult as possible for their
customers.
Here's another try with another format -- no guarantees. If you want
the script write to me privately.
Here is a template for making a new rule in Mail. All the possible
properties of 'rule' and 'rule condition' are listed with default
values so that you don't have to have the dictionary open while
you're editing the script. Just leave the properties as they are
unless you want to give them special values.
The script will only be stored and used as a filter action if you
give it a name in the dialog.
The script IF_APPLICABLE is blank. You have to fill in the actions
you want it to perform on _message.
Let me know how it works for you.
After running the Make Rule script. Open Preferences and switch OUT
OF the Rules panel and back again -- otherwise you won't see the new
rule. You must also check the enabled box.
Any suggestions for improvements to the script are welcome.
JD
tell application "Mail"
set _mailscripts to "" & (path to scripts folder) & "Mail Scripts:"
set _rulename to ""
set _ruleexists to true
set _prompt to "
M A K I N G A N E W M A I L R U L E
Type a name for the rule:-"
repeat until not _ruleexists
tell me to set dd to display dialog _prompt default answer "" with icon 1
set _rulename to text returned of dd
if _rulename is "" then return
set _ruleexists to rule _rulename exists
if _ruleexists then set _prompt to "
The rule \"" & _rulename & "\" already exists
Type another name:-"
end repeat
tell me to set dd to display dialog "
If you want the rule to call the script
type a name for the script:-" default answer _rulename with icon 1
set _scriptname to text returned of dd
set _scriptpath to _mailscripts & _scriptname as file specification
if _scriptname is not "" then set _scriptname to POSIX path of _scriptpath
set _lastposition to a reference to end of rules
set _firstposition to a reference to beginning of rules
set _ruleproperties to {color message:none, delete message:false,
forward text:"", forward message:"", mark flagged:false, mark
read:false, play sound:none, redirect message:"", reply text:"", run
script:_scriptname, all conditions must be met:false, copy
message:"", move message:"", highlight text using color:false,
enabled:true, name:_rulename, should copy message:false, should move
message:false, stop evaluating rules:false}
set _ruleconditionproperties to {expression:"", header:"",
qualifier:none, rule type:none}
set _rule to make rule at _lastposition with properties _ruleproperties
set _filter to make rule condition at beginning of _rule with
properties _ruleconditionproperties
end tell
script IF_APPLICABLE
using terms from application "Mail"
on perform mail action with messages _messagelist
repeat with _message in _messagelist
(*
do something with _message
*)
end repeat
end perform mail action with messages
end using terms from
end script
if _scriptname is not "" then store script IF_APPLICABLE in
_scriptpath with replacing
.
_______________________________________________
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.