I want to automate convert image file of PDF to eps file with ImageMagick. And I would like to be able to do this with drag and drop. So, I'd like to create an .app file using Automator.
I tried following things.
- Start "Automator.app", and Choose "Application" type for the document.
- Drag and drop "Run Shell Script" into workflow area.
- Setting the Shell is "/bin/bash", and the pass input is "as arguments".
Write the scripts below.
for f in "$@" do fname="${f%.*}" convert $f $fname.eps done
When drag and drop an image file into .app file, the following error code will be displayed.
The action "Run Shell Script" encounted an error.
How to fix it?
--
macOS Sierra(10.12)
Ensure that your environment
PATH
includes the location ofconvert
. I would also suggest moving the file extension tofname
assignment, and quote the path names (in the event of unicode file names).Tips
which convert
to find the correct path to your convert binary.During development, redirect
convert
stderr to a log file so you can evaluate the error.