[TxMt] properties parser?

Jim Tittsler jwt at OnJapan.net
Wed Jan 5 09:25:19 UTC 2005


On Wed, Jan 05, 2005 at 07:46:24AM +0100, Xavier Noria wrote:
> I have not generalised the script yet, but since it is gonna be 
> something very targeted to what I want to be useful to others anyway, 
> here it goes the starting point which is really simple if you know just 
> a bit of Python. After installing PyObjC[*] this properly modifies a 
> property list (I did the trials with the one for Perl):

And while I am one of those that thinks *every* Mac should have
PyObjC installed :-), you can also use Python's Mac standard
library plistlib to avoid the dependency.

> #!/usr/bin/python
> 
> from Foundation import NSMutableDictionary
> 
> fg = "foregroundColor"
> 
> perl = u"/path/to/your/Perl.tmbundle/Syntaxes/Perl.plist"
> plist = NSMutableDictionary.dictionaryWithContentsOfFile_(perl)

from plistlib import Plist

perl = u"/path/to/your/Perl.tmbundle/Syntaxes/Perl.plist"
plist = Plist.fromFile(perl)
...
plist.write(perl)

-- 
Jim Tittsler             http://www.OnJapan.net/      GPG: 0x01159DB6
Python Starship          http://Starship.Python.net/
Ringo MUG Tokyo          http://www.ringo.net/rss.html




More information about the textmate mailing list