Add color Tag by keyboard shortcut


#1

Hey there – I'd like to set color tags in finder using a keyboard shortcut. Is there any way to realize this in BTT? I'm looking for something like this: https://www.macrumors.com/how-to/tag-finder-items-macos-keyboard-shortcuts/

Thanks!


#2

I think the easiest solution is to use an automator workflow like in your link and trigger it using the BTT predefined action "Start Automator Workflow".

The workflow could look like this:

There are probably many other ways to achieve this, but that sounds like an easy one.


#3

Thanks for the quick reply! It does work, but it takes some 4-5 seconds until the tag appears - would you know any quicker way to achieve this?


#4

I think the main problem is that Finder takes a bit to "refresh".

You can try whether doing it with Apple Script & the xattr command is faster:

tell application "Finder" to repeat with filename in (get selection)
	set filePath to POSIX path of (filename as alias)
end repeat

do shell script "xattr -w com.apple.metadata:_kMDItemUserTags '<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><array><string>Red</string></array></plist>' " & "\"" & filePath & "\""
return selection