Hey Folks,
------------------------------------------------------------------------------------------- tell application "Mail" set newRule to make rule at beginning with properties {name:"Move-It!"} newRule exists end tell -------------------------------------------------------------------------------------------
This is cut down from a once (2011) working example, and it returns FALSE.
------------------------------------------------------------------------------------------- # Worked in 2011 — on Snow Leopard I believe. # Fails on Yosemite. ------------------------------------------------------------------------------------------- tell application "Mail" set newRule to make new rule at end of rules with properties { name: "Woohoo rule", forward message: "email@hidden"} tell newRule make new rule condition at end of rule conditions with properties {rule type:message content, qualifier:does contain value, _expression_:"woohoo"} end tell end tell
-------------------------------------------------------------------------------------------
The new rule is NOT created...
I know Brian was fighting with something like this not too long ago.
Has anyone successfully created a rule via AppleScript in Yosemite?
Has anyone tried with El Capitan?
I have successfully created a new rule-condition in an existing rule:
------------------------------------------------------------------------------------------- set ruleName to "Promotions-IN"
tell application "Mail" set msgSelList to selection
if length of msgSelList = 1 then set mailRule to rule ruleName
if mailRule exists then set theMsg to item 1 of msgSelList set msgFromAddress to (sender of theMsg)
tell mailRule make new rule condition at end of rule conditions with properties ¬ {rule type:from header, qualifier:does contain value, _expression_:msgFromAddress} end tell
else error "The named Mail-Rule does not exist!" end if else error "Problem with message selection!" end if end tell -------------------------------------------------------------------------------------------
But I don't seem to be able to create a brand new rule.
|