DTP 3.9.3 breaks the apple script command ocr from

script worked for years, after latest update DTP 3.9.3 the following command from my apple script throws the exception “AppleScript command not supported by this edition (-4)”:

tell application id “com.devon-technologies.think3”
set theRecord to ocr file thePath to incoming group

What do I need to change in my script? The script template is taken from the folder action example.

1 Like

Welcome @dominik

What operating system are you running?

Big Sur 11.7.10

appreciated, that you did reply within minutes :slight_smile:

just reversed to previous Version 3.8.3 and my script works again.

And which edition do you use? Just tried this successfully using the Pro edition.

DT Pro 3.8.3

I just tried out the upgrade process from 3.8.3 to 3.9.3 and from there I get the error, when executing my script.

See Version below:

Please choose Help > Report Bug while pressing the Alt modifier key to open a support ticket - thanks!

what script have you tried with? If you want I can try the same reference script to compare execution in my environment.

Well, basically just this script and a test image on the desktop.

ok, got it.
but result is the same:

I just spent a couple of hours trying to figure out why the folder action script Import, OCR & delete does not work. I tried to this both on Sonomo and the previous version (before I updated) and it failed silently.
I isolated that script and just came to the same conclusion.
I can only add that my debugger adds -4 to the error message:


The OS is not the cause. I think the applescript dictionary of DTP needs updating.

When I check the documentation I see the following:

It seems that the object needs to be specified beside the file and to argument.
I have no clue what that’s supposed to be.

Unrelated to this topic, but the name ‘Import, OCR & delete’ suggests that it does an import, followed by and OCR and then finally a delete. That is not the case it does an import whilst it is doing OCR. If the OCR fails the import fails.

Just for reference:


Interesting. If I do this (on an M1 MacBook Air, still on Ventura)

tell application id "com.devon-technologies.think3"
	set rec to first item of selected records
	set p to path of rec
	set newRec to ocr file p
end tell

script editor tells me

Zeilenende, etc. erwartet, aber Klassenname gefunden.

and highlights file in the ocr call. If I use (file p) instead, the script “compiles”, but when I run it, I get

error “„DEVONthink 3“ hat einen Fehler erhalten: Fortfahren nicht möglich: ocr.” number -1708

Edit In the meantime, I updated the Abbyy software from within DT, but that didn’t change anything for the script. And I tried this in JavaScript (app.ocr({file: record.path()}) which gave the notorious run-time error “parameter missing” (huh?). Similarly with convertImage({record: record}). Something is decidedly weird here.

All this with a JPG stored inside DT. I tried converting it to PDF+Text in DT itself, which was successful after I gave DTOCRHelper access to my Documents folder (weird enough, as this folder was not involved at all at this moment).

Which hardware is that - Intel or Apple silicon? And: Did you check if there’s a new Abbyy version availabe under “DEVONthink 3 / Install additional modules” (literally translated from German)?

This is Intel. The additional modules are greyed out, which means (I believe) that there is no update.

Regarding the error: Zeilenende, etc. erwartet, aber Klassenname gefunden.
Checking the applescript dictionary of Devonthink I see that the parameter right after “set newRec to ocr” is the reference to the object of the command. Do you know what the parameter reference should be?

So summarizing this I think is should be come something like:

set newRec to ocr UNKNOWN file p

where I don’t know what UNKNOWN represents.

I think this weird “reference” thingy has always been there. @cgrunenberg will certainly be able to explain this.

Also, if you search for older postings here with “ocr script”, you’ll find the syntax you (and I) used, i.e. ocr file something without any additional parameter between ocr and file.

I don’t know where you’re getting your information on the script but that is not a current script syntax.

tell application id "DNtp"
	set r to choose file
	ocr file r to incoming group
end tell

This – though obviously not error-trapped – works as expected.