OCRKit has both AppleScript support and a CLI. From their help page:
You can also script OCRKit to integrate it into your specific workflow.
For example process incoming files, via shared folder, from MFP copy
machine, etc. and simply tell OCRKit to open and thus process is via
tell application "OCRKit"
-- the wonders of AppleScript POSIX path handling, ...
open POSIX path of "/Users/Admin/Desktop/orderform.pdf"
Since OCRKit version 2.5 direct command line scripting is supported.
This greatly simplifies the use of OCRKit in batch processing, allows
to set more options and is also more robust and cross-platform than
--lang en | de | fr | es | ... \
--format pdf | html | rtf | text \
--output out-file in-file
Since OCRKit version 16.9 additional command line options are supported:
-r, --recursive directory
Scan directory recursively for new files. Skips files from OCRKit, with text layer or vector graphics.
Pattern used to match filenames during recursive scans. Defaults to
%.pdf$, recommendation for TIFF is
Write log file information and statistics during recursive scan to file.
Use secret password to decrypt PDF files during batch processing.
--test-run [ fast ]
Only run test batch processing in test mode to test PDF files or to
obtain page count to estimate total processing time. "fast" will only
check the first page of each file, instead of going thru all pages for
image and vector analyzation.
Use extended attribute name to tag the processing state of files
during batch processing.
macos:OCRKit (%s) will use native macOS
Finder tags instead, or simply
macos:OCRKit not including the state
attribute. The order of the state attribute are:
processed, and can also be