|
mac geekeryGet your geek on. |
Changing File Labels Outside The Finderrexroof asks: QuestionHow do a figure out if a file has a color label on it (and what it is) in a perl script? Any applescript or shell program to do it would be awesome. AnswerI’m not really sure if there’s a perly way to do this. I don’t see anything in File::Spec::Mac or Mac::Files that appears to handle reading or changing labels. It can be done with AppleScript, though. Try this little snippet. As is, it only works with files, not folders, but a little digging in the Finder’s dictionary should make it obvious how to use this with other filetypes.
About JC |
|
||||
perhaps when appscript is ported to perl, this will half to do.
why would appscript need to be ported to perl if Mac::Glue already exists?
If perl can run Unix commands, you can get the kMDItemFSLabel attribute with mdls. Note that the Spotlight index is different than the AppleScript index:
Spotlight AS none: 0 0 red: 6 2 orange: 7 1 yellow: 5 3 green: 2 6 blue: 4 4 purple: 3 5 grey: 1 7