Any way to set/add tags on a file with Applescript under Mavericks?
You can use xattr. This copies the tags from file1 to file2:

xattr -wx com.apple.metadata:_kMDItemUserTags "$(xattr -px com.apple.metadata:_kMDItemUserTags file1)" file2
xattr -wx com.apple.FinderInfo "$(xattr -px com.apple.FinderInfo file1)" file2


The tags are stored in a property list as a single array of strings:

$ xattr -p com.apple.metadata:_kMDItemUserTags file3|xxd -r -p|plutil -convert xml1 - -o -
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;array&gt;
    &lt;string&gt;Red
6&lt;/string&gt;
    &lt;string&gt;aa&lt;/string&gt;
    &lt;string&gt;Orange
7&lt;/string&gt;
    &lt;string&gt;Yellow
5&lt;/string&gt;
    &lt;string&gt;Green
2&lt;/string&gt;
    &lt;string&gt;Blue
4&lt;/string&gt;
    &lt;string&gt;Purple
3&lt;/string&gt;
    &lt;string&gt;Gray
1&lt;/string&gt;
&lt;/array&gt;
&lt;/plist&gt;


The tags for colors have values like Red\n6 (where \n is a linefeed).

If the kColor flag in com.apple.FinderInfo is unset, Finder doesn't show the circles for colors next to files. If the kColor flag is set to orange and the file has the red tag, Finder shows both red and orange circles. You can set the kColor flag with AppleScript:

do shell script "xattr -w com.apple.metadata:_kMDItemUserTags '(\"Red\\n6\",\"new tag\")' ~/desktop/file4"
tell application "Finder" to set label index of file "file4" of desktop to item 1 of {2, 1, 3, 6, 4, 5, 7}


'("Red\n6","new tag")' is old-style plist syntax for this:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;array&gt;
    &lt;string&gt;Red
6&lt;/string&gt;
    &lt;string&gt;new tag&lt;/string&gt;
&lt;/array&gt;
&lt;/plist&gt;


xattr -p com.apple.FinderInfo file|head -n1|cut -c28-29 prints the value of the bits used for the kColor flag. Red is C, orange is E, yellow is A, green is 4, blue is 8, magenta is 6, and gray is 2. (The flag that would add 1 to the values is not used in OS X.)