I move selected emails from Apple Mail to DT by dragging and dropping them to the Sorter in the toolbar, this generally works fine.
From time to time, the log displays words to the effect that an email was not imported ( this is not the “skipped already imported email “ message) .
This log entry only becomes apparent when next I have DT open as the front screen, by which time I may have done numerous tasks, including adding /attempting to add several emails to DT. At this stage, it is not clear which email failed to import.
If the Log window could be forced to pop up in front of all other windows, like an Apple notification, then the issue would be immediately apparent, and the failed email could be added again .
Can I achieve this through settings ( I cannot find any instructions on this ), or is there another way of receiving immediate notification of a failed email import?
I have checked that box, and the Log window pops up but it does not appear in the foreground, i.e. in front of the Apple Mail screen I have dragged and dropped from.
Perhaps this is because I am using Apple Stage Manager to display Apple Mail in one half of my main desktop, and a Task Manager in the other half. The Log window is popping up behind these rather than on top of them like a notification would. Effectively, it is still hidden.
Meantime until such a change appears in DEVONthink … what I do as a matter of course is run DEVONthink in its own macOS “Desktop” and show the log. Thus two can be shown without interference with other apps which aren’t in that “Desktop”. Muscle memory for me since Apple rolled out the “Desktop” feature.
I avoid these problems by using an Apple shortcut that includes this script (thanks @BLUEFROG). If there’s an error, the script reports it right away. If the script would fail, Shortcuts reports it right away.
That is the same layout I use. However, the pop up appears as is expected on the DT desktop to report an error that occurs whilst I am on my primary mail / tasks desktop. It looks like I will have to check the DT desktop after each addition via sorter.
Whilst I have created / modified a few scripts to help with my workflow, I am a very long way from proficient with scripting, so I’ll have to work around the issue another way.
All you need to know is how to copy and paste. The script is done. @cgrunenberg and @BLUEFROG made it for us. Here it is, if you don’t know where to look.
-- Import selected Mail messages to DEVONthink with message link.
-- Created by Christian Grunenberg on Mon Apr 19 2004.
-- Modified by BLUEFROG/Jim Neumann Tue Jan 24 2023
-- Copyright (c) 2004-2023. All rights reserved.
(* Uses the email's message ID as the imported file's URL instead of mailto: *)
-- this string is used when the message subject is empty
property pNoSubjectString : "(no subject)"
tell application "Mail"
try
tell application id "DNtp"
if not (exists current database) then error "No database is in use."
set theGroup to preferred import destination
end tell
set theSelection to the selection
if the length of theSelection is less than 1 then error "One or more messages must be selected."
repeat with theMessage in theSelection
my importMessage(theMessage, theGroup)
end repeat
on error error_message number error_number
if error_number is not -128 then display alert "Mail" message error_message as warning
end try
end tell
on importMessage(theMessage, theGroup)
tell application "Mail"
try
tell theMessage
set {theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag, theID} to {the date received, the date sent, the sender, subject, the source, the read status, message id}
end tell
set msgID to "message://%3c" & theID & "%3e"
if theSubject is equal to "" then set theSubject to pNoSubjectString
tell application id "DNtp"
set newRecord to (create record with {name:theSubject & ".eml", type:unknown, creation date:theDateSent, modification date:theDateReceived, source:(theSource as string), unread:(not theReadFlag)} in theGroup)
set URL of newRecord to msgID -- Set the URL here
end tell
on error error_message number error_number
if error_number is not -128 then display alert "Mail" message error_message as warning
end try
end tell
end importMessage
And here is the entire shortcut with the script embedded.