Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Maybe I have a solution' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Maybe I have a solution
Authored by: hamarkus on Sep 30, '09 03:32:51AM

From what I have gathered, an extended attribute in Snow Leopard can have as a 'default' representation hex OR ascii.
(1)Take a screenshot and run xattr -p com.apple.metadata:kMDItemScreenCaptureType Screenshot.png on it. You will get a hex representation. Run xattr -l on it and you get both hex and ascii.
(2) Create a new textfile in TextEdit and run xattr -p com.apple.TextEncoding File.txt on it. You will get an ascii representation of it. Run xattr -l on it, and you still get only ascii. Run xattr -px or xattr -lx on it and you get both hex and ascii.

This what I mean by having either a hex or a ascii representation as a default. Now how can be set things for both variants? The simple xattr -w nameofattribute value filename sets an attribute with ascii at the default view. But xattr -wx nameofattribute "valueinhex" filename sets an attribute with hex as the default view.

So far, pretty straightforward. But most extended attributes with hex as the default view run into multiple lines. I have so far only found somewhat of a kludge to set these: Create a multi-line environment variable in hex form and use this together with -wx. I'd be glad if somebody showed me a more elegant way of doing this.

Whether that makes this hint workable under Snow Leopard, I do not know.



[ Reply to This | # ]
Forget about that environment variable kludge
Authored by: hamarkus on Sep 30, '09 06:15:57AM

These newlines are not actually new lines. Just enter the full hex string as an argument to -wx.



[ Reply to This | # ]