Friday, January 03, 2014 ∞
-- A proof of concept
-- Returns the first proper name of an image using:
-- - PDFpenPro
-- ---- https://itunes.apple.com/us/app/pdfpenpro-6/id609313570?mt=12&uo=4&at=1l3v3KV
-- - Syn
-- ---- https://github.com/stephencelis/syn/
-- - JSON Helper
-- ---- https://itunes.apple.com/us/app/json-helper-for-applescript/id453114608?mt=12&uo=4&at=1l3v3KV
tell application "PDFpenPro 6"
-- launch the image
open theFile as alias
tell document 1
-- run it through PDFpen's OCR
repeat while performing ocr
set ocrText to plain text of page 1
-- You don't want to save your image as a OCR'd PDF for this.
close without saving
tell application "JSON Helper"
-- Output the first person name returned with Syn.
-- Make sure the path to syn (`which syn` will help)
-- is the same as I use here.
set theJSON to read JSON from (do shell script "echo '" & ocrText & "' | /usr/local/bin/syn -H -fjson | head -1")
-- Take the name and output it as a dialog box
display dialog token of theJSON as text
Archive Tags Feed Contact
© Jake Bilbrey
You can support this site by signing up for Hulu Plus.