Folder action not working

I’m pretty new to DT, so I assume I have to edit the script (import and ocr) somehow. But I don’t know how…

I want all scans that are copied to a folder “01_scan” to be moved to a folder “scan” in DT, then they should be ocr-ed, and the original file should me deleted.

So I right clicked on the folder 01_scan in finder and chose the folder action “import, ocr & delete.scpt”

But unfortunately nothing happens (folder actions are activated).
So, I assume, I have to edit the script. But I am not sure how.
Maybe, you can help me…

on adding folder items to Scan after receiving added_items
		if (count of added_items) is greater than 0 then
			tell application id "DNtp" to launch
			repeat with theItem in added_items
				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
					set thePath to theItem as text
					if thePath does not end with ".download:" then
						tell application id "DNtp"
							set theRecord to ocr file thePath to Scan
							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

Thanks for your help!

Can I tell DT to chose always the database “Belege”? and put all new file in the inbox?

“Scan” is not the folder receiving the files.

You need to locate the group in DEVONthink and assign it to the variable Scan.

For example…

set scanDest to (get record at "Scan")

get record at v : Search for record at the specified location.
get record at text : The location of the record as a POSIX path (/ in names has to be replaced with \/, see location property).
[in database] : The database. Uses current database if not specified.
→ record

Now, I am a bit puzzled.

The folder scan (in /Volumes/daten/scans on my mac) contains the scanned pdfs.

How can I move these files into DT in the database “belege” and make a ocr version of them. The original files on my mac can be deleted and the I only need the ocr files in DT.
I have no cloue about scripting.
Thanks for yout patience.

You need to attach the Folder Action to this folder.

Via the Folder Action you were talking about.

Are you trying to learn about it?

For the moment I would be thankful tonget a quick solution.
Unfortunately, korm postet a solution and had to delete it before I could look at it.

And I couldn’t find a description in your manual. Do you provide anything like that for your customers?

Start with an empty folder and attach the unedited Folder Action. Then add a file. Does it work? (And no, not does it go to some folder in some database of your choice. In general, does it work?)
Add a few more. Does it still work?

Tanks for your help and sorry for my delayed answer.
In general it seems to work:
Then I tried it with some more files. It seems the problem was that most of the files were already scant and imported in another database, apparently they were not reimported.
Finally, I deleted the old databases, tried the (original) DEVONthink - Import, OCR & Delete.scpt again and now it works.
Finally, I find a solution to tell DT in which database to import the file.

Glad to hear it seems to be working now.