Can I have some help with a shell macro?

I am trying to get a list of Finder tags with https://github.com/jdberry/tag, but I am not very experienced with shell

Currently this is the best I have come up with:


Which produces no output.

Whereas the output I expect is:

I feel pretty stuck, and I was wondering if anyone could point me in the right direction.

Yes, you are mixing a few metaphors here!

First off, the solution is very easy using the Execute a Shell Script action:

Replace the /path/to/tag with the full path of wherever you installed the tag file (in the Terminal, type which tag to find the full path). If you don't do this and just use tag, you will have to deal with the paths in shell scripts issue.

And a few comments to help with where you have gone wrong:

There is no need to use Execute AppleScript to do shell script - Keyboard Maestro has an Execute Shell Script action.

You can read Keyboard Maestro variable in a shell script using the format $KMVAR_FileTags, but they are read-only (or more accurately, if you change them like you try to do in your example GetFileTags.sh that change will not propagate back to Keyboard Maestro. To get things out of a script, you save the output (which you can do by adjusting the popup menu for where the result goes to something other than display results in a window).

1 Like

Thanks @peternlewis, I had a feeling you would come to the rescue! :slight_smile:

1 Like