Ich möchte aus Apple-Mail heraus die Anhänge bestimmter Mails automatisch in DTPO übertragen.
Das funktioniert mit den “Regeln” in Mail und dem von DT bereitgestellten Script
“Mail Rule - Add attachments to DEVONthink Pro.scpt” auch problemlos.
Jetzt will ich dieses Script dahingehend erweitern, dass im selben Arbeitsgang automatisch auch eine Kopie des Mail-Anhangs an eine andere Stelle der Festplatte kopiert wird.
Ich habe daher das Script wie folgt ergänzt und verändert:
(Leider geht die Absatzformatierung des Scripts beim Zitieren hier im Forum verloren, sodass das jetzt auf den ersten Blick sehr unübersichtlich ausschaut. Entscheidend sind natürlich die drei von mir eingefügten Zeilen in der Textmitte!)
- Mail Rule - Add attachments to DEVONthink Pro.
– Created by Christian Grunenberg on Fri May 18 2012.
– Copyright © 2012-2013. All rights reserved.
using terms from application “Mail”
on perform mail action with messages theMessages for rule theRule
tell application “Mail”
– set theFolder to (POSIX path of (path to temporary items))
repeat with theMessage in theMessages
set theSender to the sender of theMessage
repeat with theAttachment in mail attachments of theMessage
try
set theFolder to (POSIX path of (path to temporary items))
set theFile to theFolder & (name of theAttachment)
tell theAttachment to save in theFile
tell application id “com.devon-technologies.thinkpro2”
set theAttachmentRecord to import theFile to incoming group
set URL of theAttachmentRecord to theSender
end tell
set theFolder to "~/users/erik/Documente/"
set theFile to theFolder & (name of theAttachment)
tell theAttachment to save in theFile
end try
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
Leider funktioniert das so nicht. Wahrscheinlich/möglicherweise ist die Syntax/Schreibweise der Pfadanabe nicht korrekt.
Was mache ich falsch ?
Gruß
Erik