Adding tags using Punakea

This script adds the tag “ATAG” to the files selected in the Finder. I had a hard time figuring out how to get the “add_tags” command to work, so I thought I’d share this example.

tell application "Finder"
        set tagsToAdd to {"ATAG"}
	set fileList to selection
	repeat with i from 1 to (count of fileList)
		set theFilePOSIXPath to POSIX path of (item i of fileList as alias)
		tell application "Punakea"
			add_tags tagsToAdd to theFilePOSIXPath
		end tell
	end repeat
end tell

Browser: Firefox 3.0.13
Operating System: Mac OS X (10.5)