I’ve got an idea and haven’t done any applescripting’ in a long time.
I need some rules in Mail to be remotely activated.
I was thinking that I could have a master rule setup in Mail.
This ‘master rule’ would be the ‘trigger’.
I could send a message to my email with certain key words.
The ‘master rule’ would sense the key words and activate an applescript that enable/disable the appropriate ‘sub-rule’.
Here, give this a try. Save this as doRule.scpt:
using terms from application "Mail"
on perform mail action with messages theseMails
set the text item delimiters to ":"
repeat with thisMail in theseMails
set theseTerms to text items of (thisMail's subject as string)
set enabled of rule (item 2 of theseTerms) to (item 3 of theseTerms is "true")
set the text item delimiters to ""
end perform mail action with messages
end using terms from
Now create a rule called “doRule” that looks for [subject] [begins with] [“doRule:”] and fires the doRule script.
Now you can send yourself messages with subjects in the format “doRule:Name of my rule:true” or “doRule:Name of my rule:false” to turn on or off any rule. “doRule:doRule:false”, for example, will turn this rule itself off (at which point you won’t be able to turn it back on remotely, and you’ll wish I’d picked a different example…).
This assumes that you don’t use colons in the names of your rules, so if you do, replace “:” with something else in the third line, your rule filter, and your subject lines…
You, my friend, are a genious.
That works perfectly.
Thanks for the script. I’m attaching your name to it, if you’d like. And I’m going to post it to my site. Permission? I’ll give you credit, if you’ll send me your info off list.
Wait a second…
Did you write this just for me? Should I feel special? Or was this ready-made and downloadable?