– get selected files in Finder
set theSelection to {}
tell application “Finder”
set theSelection to selection
end tell
–for each file
repeat with thisPath in theSelection
–get path as bash path
set theFilePath to quoted form of the POSIX path of (thisPath as text)
–add the tag
do shell script "tag --add " & tagName & " " & theFilePath
end repeat
If I run the command manually in Terminal it works; I type tag --add ‘Send to Archive’ and then drag in a folder to get the path. (This is part of a workflow to get Hazel to move the folder to my NAS for storage.)
permissions issue? can you get it to run in Script Editor or Script Debugger?
(sorry, just saw it runs in Terminal, so permissions issue would have to be Alfred, if any)
maybe use a “set the clipboard to” your combo string and investigate if the command is as you expect?
or does do shell script require that you surround the combo in single quotes?
The addition of the two single quotes makes it match your working Terminal command.
If your previous use of this script involved single-word tags, the lack of single quotes around the tag name wouldn’t matter. That it failed when you switched to a different computer may be a coincidence.
This is a common problem. Pretty sure any automation I’ve used (KM, Hammerspoon, cron …) needs absolute paths to work right.
I sometimes set up automations I need to run on two different machines with different usernames (but synced file structures once you get to the home directory). That’s doable too.