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.
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:
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.
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:
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.