Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 9, 2012, 09:19 AM   #1
tiriya
macrumors newbie
 
Join Date: Feb 2011
"Potentially useful" Abbyy Fine Reader script. (does not replace input file)

Hello,

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

Thanks




Code:
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"
				activate
			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

Last edited by tiriya; Aug 9, 2012 at 10:32 AM.
tiriya is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Script to prevent Macbook with "Replace Soon" battery from crashing spt MacBook Pro 0 Jun 13, 2013 03:03 PM
15" RMBP Input "Hangs" (Completely Freezes) For 3-5 Seconds CBJammin103 MacBook Pro 2 Apr 11, 2013 09:14 AM
iCal "Run Script" alert opens .scpt file in AppleScript Editor instead of running it drskot Mac Programming 3 Jun 7, 2012 01:47 PM

Forum Jump

All times are GMT -5. The time now is 05:54 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC