Not quite -- this is a single command in a (one line) shell script. If you do
man screencapture in Terminal you'll see
man (manual, or "help") page, where it tells you that you use the command, then any arguments you want, and finally the file to write the image to.
Then you can use the same
exiftool command as I did. The location of installed utilities will depend on how you install them and, if done with homebrew, whether you are on Intel or Apple silicon. So it's always worth checking with
which program_name in Terminal.
% symbols denote a Keyboard Maestro token -- nothing to do with spaces. To use a variable in text you use the
%Variable%VariableName% token (while can use the shorter
%VariableName% form that can cause problems in certain situations, so it's good practice to use the explicit log form).
...can be read as "get the contents of the variable
Local_myexiftags, and if that ends with
, do something. In this case, if it ends with a comma then delete the last character -- the comma we don't want. There is no "otherwise" -- if there's no trailing comma we can leave the text as it is.
Neither the "execute..." nor the "otherwise..." parts of an "If" action a re required to have anything in them. Obviously it's a pretty pointless action if neither of them do But whether one, the other, or both do will depend on the logic of your macro. To take a real world example from right now: if I am trying to decide what to do next it might be
if it is raining
then -- which is "execute the following actions" in KM
else -- which is "otherwise execute..." in KM
But if I have to go outside I only need to decide about putting on a coat:
if it is raining
put on coat
In this case there is no input, so it is literally "from nothing". But some utilities/scripts take an input (often from "standard input", which is the keyboard) and produce output (often to "standard output", like your Terminal window). The usual example is the "transpose" utility
tr -- so to convert all the "a"s to "A"s in "banana":
echo "banana" | tr "a" "A"
...and you can do similar in KM with
tr takes input from the text field and outputs the result to a window.
Again, this is a single command shell script -- everything here is being done by
exiftool, these are just the commands and arguments to make it happen how we want.
Using a sub-macro/routine in multiple places is more about consistency and "editing efficiency" (if you need to make a change you only have to do it once, in one place) and it's generally less efficient at execution time. It might be worth doing here, so that you keep all your tags in one easily-editable list -- although I'd probably just do one macro with two different triggers (one for screenshot and one for Finder-selected) and branch depending on the trigger used (see the
The "selected files" version will be easy to write by stealing from this version (hint: the "For Each" action can use the "Finder's Selection" collection). Have a go at writing it yourself, then think about how you could combine the two versions into one.
And remember the Forum guideline -- if you've spent 5 minutes looking something up and are still stuck, shout for help!