Import, OCR, & Delete Script - Reverting File Name


I have a number of bank statements, credit card statements, etc. that are automatically renamed using Hazel and moved to a folder called Holding Folder. I just set up a new one and noticed that it’s reverting to its original name. I tried eliminating the automatic move to Holding Folder to see what happened, and I experienced the same behavior; it was one name when I moved it into Holding Folder, and in Devonthink, it was back to the original name.

Any ideas? I’m not really sure where to go with this. Here’s the script for reference; in my (very novice) opinion, it looks fine, and I don’t see how this would be happening.

– DEVONthink - Import, OCR & Delete.applescript

– Created by Christian Grunenberg on Fri Jun 18 2010.

– Copyright © 2010-2017. All rights reserved.

on adding folder items to this_folder 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 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


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

Welcome @notte

Are you running DEVONthink 3 public beta 6? If not, you should be.

Look in the Smart Rules section for a rule named Incoming Scans.

If you find it, Control-click and Remove it or Edit it and change the event trigger to On Demand.

Bingo! That was my problem. Thanks so much.

You’re very welcome. Cheers!