Hey Folks,
After all these years smart-mailboxes and incoming rules in Apple Mail cannot handle and/or...
All I want to do in my smart-mailbox is check to see if an email is:
------------------------------ IF
email is IN mailbox MBXName
AND
email is NOT read
AND
{
from contains x
OR
from contains y
OR …
}
ENDIF ------------------------------ Display in "Smart-Mailbox" ------------------------------
That's not terribly difficult logic, but the only options in Mail are ALL or ANY.
What I want to do is drop all my miscellaneous mail into one mailbox and use several smart-mailboxes to display certain categories like promotions, subscriptions-tech, subscriptions-ent...
Unfortunately I can't do that, so I have to filter them into their own separate mailboxes and then display each one.
While wrestling with some rule changes I wrote a script using System Events to pull values out of the open rule in the rule-editor.
-------------------------------------------------------------------------------------------
tell application "System Events" tell application process "Mail" set filterFieldValueList to value of text fields of scroll area 1 of sheet 1 of window "Rules" end tell end tell
set AppleScript's text item delimiters to return
bbeditNewDoc(filterFieldValueList as text, true)
------------------------------------------------------------------------------------------- --» HANDLERS (Hidden in a library on my system.) ------------------------------------------------------------------------------------------- on bbeditNewDoc(_text, _activate) tell application "BBEdit" set newDoc to make new document with properties {text:_text, bounds:{0, 44, 1920, 1200}} tell newDoc select insertion point before its text end tell if _activate = true or _activate = 1 or _activate = "activate" then activate end tell end bbeditNewDoc -------------------------------------------------------------------------------------------
I realize you can script Mail to grab these values, but for what I was doing this was more convenient to work with at the time.
Perhaps someone else might find it useful.
It's amazing the rule-editor sheet cannot be resized to see more of what's in the value fields.
Presently you can see all of 15 1/2 characters.
You can't rearrange items.
There's no rule count with the number of active and inactive rules shown.
You'd think some of these sorts of niceties would creep into a mail client that's 14 years old...
I guess I need to learn how script rules, so I can have a little more control over them.
Okay, gripe session over. :)
I haven't fooled with AppleScripts in mail-rules for a long while, because they've been so broken. Has anyone done anything especially interesting with them?
Thanks.
|