I’ve imported mbox files from archiving my Gmail account and everything has gone well, but I’d like to have the attachments handled (OCR, searchable) by devonthink as well (currently they’re just in the body of the emails). Is there any script available that separates out attachments when the messages (mbox files) are already in devonthink?
The only ones I’ve found so far seem to import mail and/or attachments from Apple Mail, but I could be offbase on this.
Devonthink 2 Pro Office
Here’s an old script importing the attachments of the selected emails. Might require some time though.
-- Import attachments of selected emails
tell application id "DNtp"
set theSelection to the selection
set tmpFolder to path to temporary items
set tmpPath to POSIX path of tmpFolder
repeat with theRecord in theSelection
if type of theRecord is unknown and path of theRecord ends with ".eml" then
set theRTF to convert record theRecord to rich
if type of theRTF is rtfd then
set thePath to path of theRTF
set theGroup to parent 1 of theRecord
tell application "Finder"
set filelist to every file in ((POSIX file thePath) as alias)
repeat with theFile in filelist
set theAttachment to POSIX path of (theFile as string)
if theAttachment does not end with ".rtf" then
-- Importing skips files inside the database package,
-- therefore let's move them to a temporary folder first
set theAttachment to move ((POSIX file theAttachment) as alias) to tmpFolder with replacing
set theAttachment to POSIX path of (theAttachment as string)
tell application id "DNtp" to import theAttachment to theGroup
on error msg
display dialog msg
delete record theRTF
Thanks and apologies on my searching skills.