Hi,
I’m trying to use the reference given back by the applescript ocr to convert to rich text, and am getting an error message that ‘Some parameter is missing for convert’. Could someone point out where I’m going wrong? I’m trying to modify the existing ‘Import, OCR & delete’ installed by DTP . I’m under the impression I should be able to pass the ‘theRecord’ return value to the input of the convert step. Any pointers would be welcome, Thanks!
basically concerned with these two lines I think. that second line returns an error 'ERROR: DEVONthink Pro got an error: Some parameter is missing for convert.
set theRecord to ocr file thePath to incoming group
set convertedRecord to convert theRecord to rich text
-- -- also tried this, as the documentation says just 'rich'
-- set convertedRecord to convert theRecord to rich
here’s the full script
-- DEVONthink - Import, OCR & Delete.applescript
-- Created by Christian Grunenberg on Fri Jun 18 2010.
-- Copyright (c) 2010-2017. All rights reserved.
on adding folder items to this_folder after receiving added_items
try
if (count of added_items) is greater than 0 then
tell application id "DNtp" to «constant rmdara24»
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
try
tell application id "DNtp"
set theRecord to ocr file thePath to incoming group
-- BEGIN modification
delay 0.2
display notification "attempting conversion to rtf" with title (id of theRecord as text)
set convertedRecord to convert theRecord to rich text
if exists convertedRecord then tell application "Finder" to delete theItem
-- END modification
if exists theRecord then tell application "Finder" to delete theItem
end tell
on error errMsg
display dialog "ERROR: " & errMsg
end try
end if
end repeat
end if
end try
end adding folder items to