I am using Hazel to run an AppleScript to execute Abbyy FineReader 12 to OCR files automatically. I am an AppleScript newbie.
I have 3 problems/questions:
1) I expect there is a way to detect if Abbyy FineReader executed successfully or had an error but I am not sure how to do it.
2) When FineReader runs, the date added and date created are set to the current date/time along with Date Last Opened and Date Last Modified. Is there a way to maintain the date added and date created as happens when I run the application manually?
3) What I really want to do, is run Fine Reader only if a new pdf is added, or if a pdf is modified by other than FineReader. Any ideas on how to accomplish that?
My apple script (which was found on the Noodlesoft Hazel forum) is run using Hazel.
I have 3 problems/questions:
1) I expect there is a way to detect if Abbyy FineReader executed successfully or had an error but I am not sure how to do it.
2) When FineReader runs, the date added and date created are set to the current date/time along with Date Last Opened and Date Last Modified. Is there a way to maintain the date added and date created as happens when I run the application manually?
3) What I really want to do, is run Fine Reader only if a new pdf is added, or if a pdf is modified by other than FineReader. Any ideas on how to accomplish that?
My apple script (which was found on the Noodlesoft Hazel forum) is run using Hazel.
Code:
on hazelProcessFile(theFile)
using terms from application "FineReader"
set langList to {English}
set saveType to single file
set exportmodepdflayout to "text under the page image"
set keepPageNumberHeadersAndFootersBoolean to yes
set keepImageBoolean to yes
set imageOptionsImageQualityEnum to high quality
set usemrcboolean to no
set makepdfaboolean to yes
set pageSizePageSizeEnum to automatic
set increasePaperSizeToFitContentBoolean to yes
end using terms from
WaitWhileBusy()
tell application "FineReader"
export to pdf theFile from file theFile
end tell
WaitWhileBusy()
end hazelProcessFile
on WaitWhileBusy()
repeat while IsMainApplicationBusy()
delay 10
end repeat
end WaitWhileBusy
on IsMainApplicationBusy()
tell application "FineReader"
set resultBoolean to is busy
end tell
return resultBoolean
end IsMainApplicationBusy