Create watermark on multiple files

I'm having some problems getting my shell command to execute. Which is a common problem, I'm aware. I have read the wiki's and have this working in another macro by @JMichaelTX here (Zip multiple files). I tried to emulate that setup but must have missed something.

I have the ENV_PATH set in variables to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Also, when I output the shell command to text, and copy and paste it into terminal, it works.

There are a few legacy actions in the macro, eventually, I hope to be able to dynamically resize the logo based upon the input file, but that will another post once I can actually execute the shell script.

The error message I am getting is Task Failed with Status 1

UPDATE: I made it work when I did my shell script like this:
magick composite "$KMVAR_logo" "$KMVAR_ShellPath" "$KMVAR_ShellPath2"

I'm still interested in knowing why the first method didn't work. I'll start experimenting with the resize now.

For Each.kmactions (9.0 KB)

It is hard to be sure without testing, but I think the problem is that each separate path must be quoted, as you did above, whereas your original only quote the variable which combined all path parameters.


1 Like

Very interesting. Thanks for clearing that up, I spent ages just trying to troubleshoot it.

So it wouldn't be possible to build a full command before passing it to the shell like I am attempting? (I may be using some wrong terminology here, but hopefully, my meaning is clear). I ask only out of curiosity. The workflow is easier to modify using separate variables anyway.

Yes you can, you just need to add the quotes around each path in the command line you are building.

Here's the final result. This macro adds a image file of one's choosing (a png file works best, I haven't tested it with others) as a watermark in the bottom left of the image, just in a little bit. The width of the watermark is in relation to the size of the original, so you can bulk watermark. It needs Imagemagick installed. I'm very pleased with it.

Keyboard Maestro Actions.kmactions (6.8 KB)