On Sep 19, 2009, at 11:34 AM, Adam R. Maxwell wrote:

However, I would be glad if someone could tell me whether there is a technique to extract from Bdsk-File-1{} entries that are broken in such a manner the actual info, i.e. relative or absolute path. Since my attempts to use AppleScript statements such as

   set allLinkedFiles to (get POSIX path of linked files)
   set allLinkedHFSFiles to (get linked files)
   set allLinkedFileURLs to (get URL of linked files)

resulted in that situation only as a missing value item, yet the bib file itself still contained the Bdsk-File-1{....} fields with lots of for human eyes unreadable content.

Some time ago, I wrote a python program that extracts relative paths:

http://homepage.mac.com/amaxwell/.cv/amaxwell/Sites/.Public/read_bdsk_file.py-zip.zip

No guarantee that it keeps working, but you may find it useful.

If you don't mind hacking the PyObjC support in the OS, on 10.6 you can use the new URL bookmark functionality to extract an absolute path from the alias portion as follows:

# create bookmark from the embedded alias record in a bdsk-file field
bmd = CFURLCreateBookmarkDataFromAliasRecord(None, plist["aliasData"])
relURL = NSURL.fileURLWithPath_("/")
x = NSURL.URLByResolvingBookmarkData_options_relativeToURL_bookmarkDataIsStale_error_ (bmd, 0, relURL, None, None)
# I think this should be a tuple to return the bool/error by reference
# but it's either an NSURL or None
print x

I'm not sure on the relative URL, but it worked for me.  I had to add

  <function name='CFURLCreateBookmarkDataFromAliasRecord'>
    <retval already_cfretained='true' type='^{__CFData=}' />
    <arg type='^{__CFAllocator=}' />
    <arg type='^{__CFData=}' />
  </function>

after the CFURLCreateWithString definition in /System/Library/ Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC/ LaunchServices/PyObjC.bridgesupport.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to