Folder Action import from Dropbox

Hey everyone,

after using a ScanSnap ix500 for quite some years I just got myself a shiny new ix1600 with the intent to keep out the computer at scantime and directly scan to the cloud and later import into DevonThink. Scanning and moving stuff to the dropbox works just fine. I found out that the right way to auto import into Devonthink from a folder would be folder action scripts. I never used them before but that basically sounds easy. Script is installed and activated. Whenever a new file arrives Devonthink instantly opens but then nothing happens. I used the Import & Delete example script and by looking at it, it doesn’t look like I need to change anything on the script.

Maybe I’m just missing something… here’s the script I’m using:

-- DEVONthink - Import & Delete.applescript
-- Created by Christian Grunenberg on Fri Mar 26 2010.
-- Copyright (c) 2010-2014. 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
				try
					set thePath to theItem as text
					if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
						tell application id "DNtp"
							set theRecord to import thePath to incoming group
							if exists theRecord then tell application "Finder" to delete theItem
						end tell
					end if
				end try
			end repeat
		end if
	end try
end adding folder items to

I’m on Devonthink 3.8

Cheers,
Frank

Congratulations on the new scanner! :smiley:

I found out that the right way to auto import into Devonthink from a folder would be folder action scripts.

Actually, that’s old tech (and possibly you may be having an issue with macOS’ Automation options in Systemp Preferences > Security & Privacy).

Instead of using a folder, have you considered indexing that scanning destination folder in Dropbox then using DEVONthink’s smart rules to file the item?

Are you intending to keep the files in the Dropbox folder in the Finder?

I can vouch for the Indexed folder on Dropbox with a smart rule to process.
I frequently use other computers with nothing on them but production software and highly mediated internet connections.(Bespoke VPN, firewalls etc). The ubiquity of Dropbox for file transfer means that I can usually get IT departments to let me into the web interface of Dropbox on those machines. I have two Dropbox folders for two different databases that are indexed in DT and anything put in those folders is imported and tagged as New Import.
When I see my DevonThink installs on my own computers, a smart group of New Import is right there to show me what I added.

3 Likes

No, i just didn’t know about that. I basically have used Devonthink as a big scan/archive/search engine without doing a whole lot sorting. The OCR is good enough for me so I do find everything I need later. Guess I need to dig a bit deeper for that. So far I have done this all locally on one machine. I want to keep this more independent from one machine with the new scanner - hence the dropbox way.

No, they should just move into the DT database and be deleted from that Dropbox folder.

Here’s an example smart rule…

  • It targets an indexed Finder folder files needing OCR would be put into.
  • It checks for a specific tag (this is optional).
  • It looks for images or PDFs with no words.

On import, i.e., when you drop a file into the folder and DEVONthink detects it…

  • The file is moved into the database. This is an import and removes the file from the Finder folder. No cleanup needed!
  • Does OCR on the file. The Apply option doesn’t genetate a new file. Again, no cleanup needed.
  • Tags the file (still optional)
  • Moves the file into a destination group.

Here is the smart rule if you’d like to mess with it…
Import from Finder, OCR, and File.dtSmartRule.zip (1010 Bytes)

1 Like

Newbi question:

  1. Why is “indexed Finder folder” important (and what is it)?
  2. How do I create such an indexed folder?

Thanks so much

@moselblick not sure if this has been answered yet but it seems to have gotten overlooked here. That indexed folder should take care of monitoring a folder on your drive for new documents. You can then target it with automations to import it or do otherwise.

@BLUEFROG I’m using your suggested way for a while now but keep having issues every now and then where my Indexed folder doesn’t update the content from the hard disk. I just removed it and added it back again. It then seems to show and process all the files in there - however, when I do add new files afterwards they don’t seem to get recognized again. Any idea why this happens?

I just added the folder via the file menu. The folder is within my dropbox folder but I made sure it’s set to always download files offline.

Any help is appreciated.

There is nothing amiss here.
Folders synced by cloud services don’t necessarily invoke filesystem events. Also, DEVONthink tries to make sure it doesn’t get in the way of the processes syncing those folders.

Use of File > Update Indexed Items is the method to use in these circumstances.

Unfortunately updating manually doesn’t do anything and weirdly it worked for months already so I’d assume dropbox isn’t the issue here.

The folder shows as a group in Devonthink ad shows a tiny little Finder icon to the right. Is this correct? I added it through File > Index Files and Folders (translated from german UI so it might not be the exact wording).

Is this the correct way to doi it?

Yes, the Finder property icon indicates indexed items.
I’m guessing you have indexed items in the database’s Trash, inhibiting the refresh of items. You’d need to empty the database’s Trash to alleviate this.

However, indexing is not the default mechanism for a reason. It is discussed in the Help > Documentation > In & Out > Importing & Indexing , especially the Indexing and the file system section. Pay special attention to the Indexing and the filesystem section so you understand how actions in DEVONthink can affect files in the file system.