MacOS – Automator Newbie question

automatorfindermacos

I'm running my Mac under 10.9.2 and have about 75 scanned Tiff files which need to be processed through the OCR app, TesseractGUI 0.3. It works very well for me but balks at .tiff extensions and Alpha enabled files. In small batches I've been using Preview to Export, deleting the second "f" and unchecking the Alpha. This manual file adjustment works well.

Time to put Automator to use. I've gone through Apple's "Basic Tutorial" but there's not enough detail to find my way. I've been having a devil of a time getting inexplicable running errors.

I've conceived of a routine where whatever is put in a "Process" folder on the desktop will automatically delete the second "f" in the extension and uncheck the Alpha. Then move the revised file to a "Processed" folder also on the desktop. That way I'd still have my unchanged originals as well as files TesseractGUI will accept.

Appreciate some guidance.

Best Answer

You can run a Terminal command to batch edit the extensions and move the files to the processed folder:

cd /path/to/folder

where /path/to/folder is the folder containing the originals.

for file in *.tiff; do cp "$file" "${file%tiff}tif"; mv *.tif ~/Desktop/Processed; done

This command will leave the originals in the original folder, and move the "processed (tif)" files to the "Processed" folder. The script is a bit sloppy regarding syntax, but would easily get the job done. I don't know how to automate unchecking "Alpha."

Note that you can incorporate Shell commands into an Automator routine as well, under Library > Utilities > Run Shell Script.