FWIW Here’s a modification of the Import, OCR & Delete script that
- Imports to the location of your choice (see the properties at the start)
- Runs OCR on PDFs and does a simple import on non-PDF documents
Finally, you can test it by running from Script Editor as well. Seems to work well as a Folder Action script.
-- DEVONthink - Import, OCR & Delete.applescript
-- Created by Christian Grunenberg on Fri Jun 18 2010.
-- Copyright (c) 2010-2017. All rights reserved.
-- dbyler update: files to a specific location (h/t https://discourse.devontechnologies.com/t/adding-to-the-import-ocr-delete-script/24777/1) and support non-PDF docs
property myDatabase : "Admin"
property myDatabasePath : "/Users/YOURNAME/Documents/DEVONthink Databases/" & myDatabase & ".dtBase2"
on run
set mySelection to (choose file with multiple selections allowed)
my main(mySelection)
end run
on adding folder items to this_folder after receiving added_items
my main(added_items)
end adding folder items to
on main(added_items)
try
if (count of added_items) is greater than 0 then
tell application id "DNtp" to «constant rmdara24»
repeat with theItem in added_items
set thePath to theItem as text
set myOcr to (thePath ends with ".pdf")
if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
set lastFileSize to 0
set currentFileSize to 1
repeat while lastFileSize ≠ currentFileSize
delay 0.5
set lastFileSize to currentFileSize
set currentFileSize to size of (info for theItem)
end repeat
try
tell application id "DNtp"
if not (exists (database myDatabase)) then -- Is the database open?
set theDatabase to open database myDatabasePath -- Open it, if not.
else
set theDatabase to database myDatabase
end if
set theGroup to get record at "/Inbox" in theDatabase -- Get the location of the destination group in the database.
if myOcr then
display notification "Importing to DT (OCR)"
set theRecord to ocr file thePath to theGroup
else
display notification "Importing to DT"
set theRecord to import thePath to theGroup
end if
if exists theRecord then tell application "Finder" to delete theItem
end tell
end try
end if
end repeat
end if
end try
end main