On 08/11/09 16:33, "M. Tamer Özsu" <[email protected]> wrote:

> Thanks Adam, I'll check those out.

Here's a short Python program that might help if you're reading binary
property lists from extended attributes (such as OpenMeta).  You should be
able to use this with `do shell script` in a script hook, if I read
http://developer.apple.com/technotes/tn2002/tn2065.html correctly.

import sys
import xattr
from Foundation import *

if len(sys.argv) == 1:
    print "need a filename argument"
    exit(1)

inputPaths = sys.argv[1:]

for path in inputPaths:

    # read all extended attributes
    xa = xattr.xattr(path)
    
    # print the names of all attributes (strings)
    print xa.keys()

    # print the value of the finder comment if it exists
    if "com.apple.metadata:kMDItemFinderComment" in xa:

        # binary plist as string
        plstr = xa["com.apple.metadata:kMDItemFinderComment"]

        # convert to NSData
        pldata = NSData.dataWithBytes_length_(plstr, len(plstr))

        # parse the binary property list
        plist, format, error =
NSPropertyListSerialization.propertyListFromData_mutabilityOption_format_err
orDescription_(pldata, NSPropertyListImmutable)

        print plist



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to