I have set up a simple rule in Apple Mail (Version 14.0 (3654.20.0.2.21) on macOS 11.0.1) to run Apple Script when mails arrive addressed to a specific address.
The actions are:
Move Message to mailbox nameofmailbox
Run AppleScript Mail Rule - Add messages to DEVONthink
What happens is than an empty mail appears in the Global Inbox in DT 3.6.1. An error appears in the log: 14:50:58: ~/Library/Application Support/DEVONthink 3/Inbox.dtBase2/Files.noindex/eml/2/Test3.eml A parsing problem occurred: mailbox “Test3.eml” should contain 1 message and it contains 0.
Yes, it does - but I can’t influence the order of the actions in Mail - I had actually set it to run AppleScript first and move second - but Mail changes the order to move first.
I’ve just tried adding a delay in the script - the result is that the first message in the Mail inbox is then transferred to DT, rather than the original message. So the move is the problem - any suggestions?
(I suppose I could duplicate the script and add a line or two which instruct Mail to move the mail to a folder once it has copied it to DT)
It works without the Move action, yes - the script apparently loses sight of which mail it is supposed to be working on when the message is moved first.
Either a bug in Mail’s AppleScript support (wouldn’t be the first and only one) or how it executes rules. Adding the move action to a customized script is probably the only workaround.
I’m in a bit of a hurry with this, and a quick search and using the dictionary have not provided any help on how to actually implement “move message to folder called abc” in Mail - so if anybody has something just sitting there ready to be copied, I’d be grateful thx
thx - unfortunately the suggestion there move this_message to mailbox "BILL PAY/Mortgage & HOA" of account "iCloud" was the structure I had expected - it just doesn’t do anything.
what works is move theMessage to (first mailbox whose name is "abc") of account "xyz" - so for whatever reason it seems I am not able to correctly define the mailbox (or mailbox path) correctly. The above works, because I only have one mailbox called “abc”; but if anybody can shed any light on why that works, but neither to mailbox "abc" nor to mailbox "Inbox/abc" (which is the structure displayed in Mail) works, that’d be nice
Hard to tell whether these alternatives should actually work, the documentation of AppleScript suites is usually very limited and Mail’s AppleScript notoriously buggy.
Heaven only knows! My love for DEVONthink grows daily - you have developed such an amazingly powerful piece of software, and the failings of other software just serve to keep reminding me of that fact. Thanks for assisting me today - you have just helped me streamline my work in relation to a renewed state of emergency concerning the pandemic.
Even setting up a second independent rule to move the message didn’t help, because it moved it whilst the first rule was still running - and there is no way to add a delay. What a brilliant piece of software. You’ve just got to love the power of Apple’s software and its implementation of AppleScript. It’s just a good job I still have to work with Windows, just to keep reminding me how very frustrating that experience is.
Unfortunately Apple seems to be more interested in machine learning, UI revisions, adding animations and treating customers like kids than in stuff like Mail, AppleScript or productivity lately.
(Re Apple’s approach to automation, of course) it’s not only AppleScript they’re failing at – JAX had been introduced with big fanfare and then abandoned.
On the other hand, I like that some products are now doing it on their own, eg Hazel, Drafts, Scriptable and to a lesser degree DT.