View Full Version : "Potentially useful" Abbyy Fine Reader script. (does not replace input file)

Aug 9, 2012, 08:19 AM

I "prepared" an initial script for Abbyy Fine Reader for Mac by basically copy/pasting pieces of scripts available on the net (I am a novice).

Currently, the script adds the suffix "OCR" to pdf outputs. The line: 'keystroke baseName & " OCR"'

This may be useful, I hope, for e.g. converting multiple images to separate OCR'd files.

A limitation: Abbyy has to be visible for this work (probably, not much can be done regarding that)

Another limitation: In the absence of that line, I could not find the way to make the script continue with "replacing" pdf input files when the question "are you sure..." appears after clicking the button "Save" in the window "Save Converted File As." Not very important, but it would be nice to learn that...


tell application "Finder"
set sel to selection
if sel is not {} then
repeat with i from 1 to number of items in sel

set filepath to item i of sel as text
set posixFilePath to POSIX path of filepath
set fileName to name of item i of sel as text
set nameExtension to name extension of item i of sel as text
set baseName to text 1 thru ((get offset of "." & nameExtension in fileName) - 1) of fileName

tell application "ABBYY FineReader Express"
end tell
delay 2
tell application "System Events"
tell process "ABBYY FineReader Express"
click menu item "New Task..." of menu "File" of menu bar 1
delay 0.1
click button "Convert to Searchable PDF" of window "Quick Tasks"

keystroke "g" using {command down, shift down}
delay 0.3

keystroke posixFilePath
delay 0.3

keystroke return
delay 0.3
keystroke return

repeat until window "Save Converted File As" exists
end repeat
keystroke baseName & " OCR"
click button "Save" of window "Save Converted File As"
repeat until window "Abbyy FineReader Express" exists
end repeat

end tell

end tell
delay 3

end repeat
end if
end tell

tell application "ABBYY FineReader Express" to quit