ich habe eine Frage an die Runde:
Ich nutze in Apple Mail eine Regel, um meine E-Mail-Anhänge automatisch über das Skript „Mail Rule – Add attachments to DEVONthink“ zu importieren.
Soweit funktioniert alles, allerdings werden nicht nur meine eigentlichen Dokumente importiert (z. B. PDFs oder Word-Dateien), sondern auch sämtliche Grafiken – wie Logos, Facebook-Bilder, Werbegrafiken usw.
Diese möchte ich nicht mitimportieren, sondern ausschließlich die Dokumente.
Momentan lösche ich die Grafiken nach dem Import manuell. Ich habe auch versucht, das über eine Regel zu filtern, aber da jede Grafik anders benannt ist, komme ich damit nicht weit (ich habe schon über 100 Ausnahmen eingetragen).
Gibt es eine Möglichkeit, das Skript so anzupassen, dass nur Dokumente importiert und Grafiken automatisch ausgeschlossen werden?
Ich hoffe, ich konnte mein Problem verständlich schildern und freue mich über jeden Tipp!
Dies ist der Code im Skript, der aktuell alle Anhänge, egal welcher Art, importiert:
set theFile to theFolder & (name of theAttachment)
tell theAttachment to save in theFile
tell application id "DNtp"
set theAttachmentRecord to import path theFile to attachment_group
set unread of theAttachmentRecord to (not theReadFlag)
set URL of theAttachmentRecord to theSender
perform smart rule trigger import event record theAttachmentRecord
end tell
Eine entsprechende Änderung könnte z.B. so aussehen:
set theFile to theFolder & (name of theAttachment)
if theFile does not end with ".png" and theFile does not end with ".gif" and theFile does not end with ".jpg" then
tell theAttachment to save in theFile
tell application id "DNtp"
set theAttachmentRecord to import path theFile to attachment_group
set unread of theAttachmentRecord to (not theReadFlag)
set URL of theAttachmentRecord to theSender
perform smart rule trigger import event record theAttachmentRecord
end tell
end if
Ggf. muss die Abfrage noch um weitere Typen erweitert werden.
und Danke für die schnelle Antwort.
Ich habe noch nie mit Skripten gearbeitet, da ich das alle nicht verstehe (bin schon etwas älter).
Wie müsste ich jetzt genau vorgehen?
Schon mal Danke.