i have thise code

tell application "DEVONthink Pro"
	set sel to (get records of database "inbox")
	repeat with s in sel
		if type of s is PDF document and word count of s is 0 then
			ocr s			
		end if
	end repeat
end tell

that results in an error

DEVONthink Pro got an error: Some parameter is missing for ocr.

what do i have to change to make this work? all i want to do is convert a PDF to PDF+text. basically what “data > convert > to searchable PDF” does.


How about ocr file s?

results in

DEVONthink Pro got an error: This command only accepts image files.

That was the missing parameter. :smiley:

Beyond that, I didn’t implement the Applescript support so…

i see, thank you. should i create a support ticket or wait in here?

Though I can’t claim it’ll do what you want (and I’m not sure if it was implemented for this purpose), try…

			convert image record s

```In a real quick test with a PDF selection, it fired up the OCR process.

PS: Are you reading the AS dictionary?

that seems to be doing exactly what i want, thank you.

yes i am reading the AS dictionary which says

i didn’t think a record of type PDF document is considered an image :wink:

Nor did I - but dictionaries are “hand-written”. I was surprised too but there ya go. :smiley: