"File not found" when running command-line tools in Automator
I often use ocrmypdf --force-ocr --output-type pdfa-1 input.pdf output.pdf in order to ocr pdfs. But it's tedious typing in all the terms every time, so it's a good candidate for Automator.
Based on another script, I tried:
Application receives files and folders as input > Run shell script
Shell:/bin/bash Pass input: as arguments
for f in "$@"
do
suffix="-OCRA1.pdf"
base=`basename "$f" .pdf`
outputfile=$base$suffix
/usr/local/bin/ocrmypdf --force-ocr --output-type pdfa-1 $@ "$outputfile" "$f"
done
I keep getting an error saying that Automator was unable to find tesseract. It is in /usr/bin where ocrmypdf usually has no trouble calling it.
I don't know what's going wrong or what can fix it.
Mac mini 2018 or later