matthias oberlaender wrote:
>I would very much like to get and set the color label (or 'label index')
>of a file programmatically from Python. I spent quite some time googling,
>but was unable to extract the necessary bits how to do it with a few
>Carbon calls.
Dunno about Carbon APIs, but it's easy enough using IPC:
#!/usr/bin/env pythonw
from appscript import *
from macfile import Alias
path = '/Users/has/test.txt'
label = 3
app('Finder').items[Alias(path)].label_index.set(label)
print app('Finder').items[Alias(path)].label_index.get()
See <http://freespace.virgin.net/hamish.sanderson/appscript.html>. Note: if you
install appscript using the binary installer (easiest), you'll also need to d/l
the latest appscript-0.13.1.tar.gz package from
<http://freespace.virgin.net/hamish.sanderson/appscript_source.html> and
install that as well.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Pythonmac-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig