This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### | |
# Found on http://www.documentsnap.com/abbyy-finereader-and-snow-leopard-file-not-created-with-scansnap/ | |
# and modified to work from command line and behave slightly differently. Creating an Automator script | |
# to trigger should be trivial, though. you'd want to add a "cd /path/to/incoming_scans" at the top. | |
# | |
# Works with ScanSnap on Snow Leopard with the latest Abby Fine Reader and ScanSnap drivers. Doesn't | |
# do the meta data munging though that should be trivial to add back in. | |
# | |
# Do you scanning all at once, then kick this script off when you leave your computer - this results in a | |
# great speed up in workflow | |
##### | |
# For every document... | |
FILES="*.pdf" | |
for f in $FILES | |
do | |
echo $f | |
# Get the name of the file without the full UNIX path and store it in the variable g | |
# This will just make the Growl notification easier to read | |
g="${f##*/}" | |
g="${g%.*}" | |
# Tell FineReader to open the pdf, and thereby start OCRing it. | |
open -a 'Scan to Searchable PDF.app' "$f" | |
# Since FineReader is not directly scriptable, check the directory every 30 seconds and wait until | |
# there is a file named "[yourPDFname] processed by FineReader.pdf". That's how you know FinderReader is done. | |
while [ ! -e "${f%.pdf} processed by FineReader.pdf" ]; do | |
sleep 5 | |
done | |
# I don't remember why I wanted to wait another 15 seconds. | |
# I must have had a good reason at the time. Usually this just helps handle glitches. | |
# You can probably delete this without ruining Christmas (or your favorite holiday). | |
sleep 15 | |
# Move thie file to the "Scan Output" directory in the parent directory | |
# This deletes the original and replaces it with the OCR'd version | |
mv -f "${f%.pdf} processed by FineReader.pdf" "../Scan Output/$f" | |
rm "$f" | |
# Tell Growl to notify you. Use the icon from FineReader, use "FineReader for ScanSnap" as the title of the notification, | |
# and use "FineReader has finished OCRing [yourPDFname]" as the message | |
/usr/local/bin/growlnotify -a "FineReader for ScanSnap" -t "FineReader for ScanSnap" -m "FineReader has finished OCRing $g" | |
# Exit | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment