I have a long list of mail rules. All of them, normally, are enabled. About the fouth rule down unconditionally stops evaluation rules. Its called the “Stop Here” rule. This keeps all the messages except spam in my inbox. I read the messages as they come in.
My morning routine is to disable that rule, select all the messages in the In Box, and “Apply Rules” which sorts the messages into various mail boxes, etc. I then move the messages that remain to my “2006” mail box. I do the same with the “Sent” mail box. I then go back and re-enable the Stop Here rule.
Clearly something that needs to be scripted. But I don’t have a clue where to start. The problem is two fold:
First, I guess there are now two approachs to scripting: one via the GUI interface using “System Events” and the other via regular Applescript objects, etc. It seems like the “regular” method would be better for enabling and disabling the “Stop Here” rule… except I don’t see an action to enable or disable it. I see a property that tells me if it is enabled or disabled. But no way to change it.
Second, with the System Events thing, trying to figure out what something is called and how to get System Events to tickle the target application in the way that I want. That appears to me to be black magic.
Can anyone help me figure out either of these two stumbling blocks?
How do you do apply the rules to a list of messages. I figured out:
tell application "Mail"
set inboxMessages to messages of inbox
end tell
will get me the list of messages. Now I’m trying to figure how how to run the rules on all of them. “perform mail action with messages” looks promising but the dictionary I’m looking at doesn’t really say what it does exactly.
tell application "Mail" to activate
tell application "System Events"
tell process "Mail"
keystroke "1" using command down
delay 0.5
keystroke "a" using command down
delay 0.5
keystroke "l" using {option down, command down}
end tell
end tell
In the normal mail window, if the bottom panel is picked, then the select all command selects all of that message – not all of the messages in the Inbox.
I’m trying to figure out how to pick the top panel.
Is there a list of documents that I can study? I get so frustrated with Applescript. I have the language guide but I have not read it. Its too thick. And I try searching it but can never find things that help. I also try googling but that rarely helps. And then the GUI stuff seems even more magical.