Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript-xattr

Hey, i have used the xattr commnad in applescript to list the tag of the file example.rtf (as below)



xattr -px com.apple.metadata:_kMDItemUserTags "example.rtf" | xxd -r -p - - | plutil -convert json -o - - | sed 's/[][]//g' | tr ',' '\n'


and the result is

"Ricette\n5"




What i need now is to SET the TAG of another file (es. pink.rtf) like the previous result "Ricette".



Can someone help me?

MacBook Pro, OS X Mavericks (10.9), MBP,iMac,iphone,iBook G4

Posted on May 26, 2014 7:04 AM

Reply
6 replies

May 27, 2014 5:56 AM in response to Barney-15E

You are right. I found the solution there.


Now a have, hope,last question. The following script is correctly working using Terminal

xattr -wx com.apple.metadata:_kMDItemUserTags "$(xattr -px com.apple.metadata:_kMDItemUserTags aaa.rtf)" bbb.rtf;xattr -wx com.apple.FinderInfo "$(xattr -px com.apple.FinderInfo aaa.rtf)" bbb.rtf


but when i put it in the applescript


do shell script "xattr -wx com.apple.metadata:_kMDItemUserTags "$(xattr -px com.apple.metadata:_kMDItemUserTags aaa.rtf)" bbb.rtf;xattr -wx com.apple.FinderInfo "$(xattr -px com.apple.FinderInfo aaa.rtf)" bbb.rtf"

it returns me the error

Syntax Error

Expected end of line, etc. but found unknown token.

Applescript-xattr

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.