Import files with a Folderaction into a specific Group in Devon Office

Hi, I’m scanning with Scanner Pro on my IPhone and have the files uploaded into a Dropbox Folder.

This Dropbox folder is set up this an folder action which imports the files into Devon Office, does OCR and deletes the files after completion.

The only thing I’d like to change in this workflow is the Import location in Devon Office. The default location is the global IN Box.

Can you tell me how to change the default script to import the files e.g. to a Group INBOX/SCANS ??

Thanks
Jörg-Mark

-- DEVONthink - Import, OCR & Delete.applescript
-- Created by Christian Grunenberg on Fri Jun 18 2010.
-- Copyright (c) 2010-2017. All rights reserved.

on adding folder items to this_folder after receiving added_items
	try
		if (count of added_items) is greater than 0 then
			tell application id "DNtp" to launch
			repeat with theItem in added_items
				set thePath to theItem as text
				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"
							set theRecord to ocr file thePath to incoming group
							if exists theRecord then tell application "Finder" to delete theItem
						end tell
					end try
				end if
			end repeat
		end if
	end try
end adding folder items to

Since version 3 it’s usually recommended to use indexed folders & smart rules instead of folder actions. E.g. you could index the Dropbox folder containing the scans to the global inbox, afterwards a smart rule triggered on importing could process new scans (e.g. move them into the database and OCR them).

1 Like

Criss’ comments are spot on but for your education…

Replacing the DEVONthink tell block like so would work, provided there’s a Scans group in the Inbox of the specfied database.…

tell application id "DNtp"
	set loc to get record at "/Inbox/Scans" in database ________ -- Fill in your database name, quoted.
	set theRecord to ocr file thePath to loc
	if exists theRecord then tell application "Finder" to delete theItem
end tell

Thank You – this really helped :grinning:

You’re very welcome.

However, do spend a bit of leisure time in the Help > Documentation > Automation chapter and exploring smart rules.
:slight_smile: