Mein Arbeitsablauf besteht darin, alle eingehenden Dokumente von Mail.app zu markieren und in Devonthink abzulegen. Ich mache das mit Applescript. Das Skript funktioniert mit einer Ausnahme einwandfrei - ich weiß nicht, wie ich es dazu bringen soll, ZIP- und RAR-Dateien in den Anhängen zu erweitern, bevor ich sie nach Devonthink verschiebe. Wäre wahrscheinlich ein Unarchiver oder ein anderes skriptfähiges Archivierungsprogramm erforderlich. Ich würde mich über Ihre Vorschläge freuen. Mein Skript ist unten.
property pNoSubjectString : "(no subject)"
tell application "Mail"
try
tell application id "com.devon-technologies.thinkpro2"
if not (exists «class DTcu») then error "No database is in use."
end tell
set theSelection to the selection
set theFolder to (POSIX path of (path to temporary items))
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, theFolder)
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, theFolder)
tell application "Mail"
try
tell theMessage
set {theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag} to {the date received, the date sent, the sender, subject, the source, the read status}
tell application "MailTagsHelper"
tell theMessage
set theTags to the keywords
end tell
end tell
end tell
if theSubject is equal to "" then set theSubject to pNoSubjectString
set theAttachmentCount to count of mail attachments of theMessage
tell application id "com.devon-technologies.thinkpro2"
set theGroup to «class DTig»
if theAttachmentCount is greater than 0 then set theGroup to «event DTpacd08» {name:theSubject, «class DTty»:«constant DtypDTgr»} given «class DTin»:theGroup
set theRecord to «event DTpacd08» {name:theSubject & ".eml", «class DTty»:«constant Dtyp****», «class DTcr»:theDateSent, «class DTmo»:theDateReceived, URL:theSender, «class conT»:(theSource as string), «class tags»:theTags} given «class DTin»:theGroup
set «class DTur» of theRecord to (not theReadFlag)
end tell
repeat with theAttachment in mail attachments of theMessage
set theFile to theFolder & (name of theAttachment)
tell theAttachment to save in theFile
tell application id "com.devon-technologies.thinkpro2"
set theAttachmentRecord to «event DTpacd01» theFile given «class DTto»:theGroup
set «class DTur» of theAttachmentRecord to (not theReadFlag)
set URL of theAttachmentRecord to theSender
set «class tags» of theAttachmentRecord to theTags
end tell
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
end importMessage