I'm trying to create a simple workflow that will be used to help non-technical people use tesseract OCR. I have no problem using it myself, but others probably prefer GUIs, so I'm working on the following automator workflow (image below): https://drive.google.com/file/d/1nxiQVt7sQigQwgjpscG-0E9loCRO7Fxe/view?usp=sharing
Script:
set appName to "Terminal"
if application appName is running then
tell application "Terminal"
activate
do script "tesseract /Users/jackson/Downloads/OCRTemp.jpg /Users/jackson/Downloads/OCRTemp.txt"
end tell
else
tell application "Terminal"
activate
do script "tesseract /Users/jackson/Downloads/OCRTemp.jpg /Users/jackson/Downloads/OCRTemp.txt" in front window
end tell
end if
The problem is that in the line "tesseract /Users/jackson/Downloads/OCRTemp.jpg /Users/jackson/Downloads/OCRTemp.txt"
I would like to replace the first file extension with the clipboard. Not being well versed in how to use bash, I'm not entirely sure what to do. I think part of the confusion is that I'm using an applescript to run a terminal command, so I'm not sure if I use applescript or terminal to get the variable.
Best Answer
No need for Automator.
Just use AppleScript (Change
/opt/local/bin/tesseract
to the output ofwhich tesseract
):