Last active
April 24, 2017 10:42
-
-
Save panagiotisTB/b3d0ecb8429bbe07de8d2e560f77354f to your computer and use it in GitHub Desktop.
A script to automatically OCR Files in a given Folder (macOS Folder Actions).
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
on adding folder items to this_folder after receiving these_items | |
repeat with i from 1 to number of items in these_items | |
set this_item to item i of these_items | |
set the item_info to info for this_item | |
set the item_size to size of (info for this_item) | |
set delay_time to ((item_size / 1024 / 30) as integer) | |
set file_type to name extension of (info for this_item) | |
if file_type is equal to "pdf" then | |
tell application "Finder" | |
set file_name to displayed name of this_item | |
end tell | |
if file_name contains "-OCR" then | |
tell application "Together 3" | |
activate | |
import files this_item | |
end tell | |
else | |
tell application "OCRKit" | |
activate | |
open this_item | |
end tell | |
end if | |
end if | |
end repeat | |
end adding folder items to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment