Thank you Charles. That seems to require installation of appscript, which in my my case fails with
unable to execute llvm-gcc-4.2: No such file or directory Also, does one set up this script the same way as any other applescript (once appscript is installed)? Thanks for any pointers. -- M. Tamer Özsu University of Waterloo On 2011-11-12, at 3:03 PM, Charles Turner wrote: > On Sat, Nov 12, 2011 at 6:32 AM, "M. Tamer Özsu" <[email protected]> wrote: > >> Christiaan kindly explained that to automatically put the open meta tags in >> the keywords field I would need to use a script hook. I wonder if anyone has >> written a script for this purpose. > > Well, in Python using py-appscript: > > > # Get the union of all the linked files of a Bibdesk publication, > # then update (replace) the keywords of the publication with the union. > # If the publication has keywords but no linked files, then preserve > # the existing keywords. > # Charles Turner - 2010-02-28 > > # Issue: if you have a tag like "theory and analysis," and it's the only > # tag in the keyword field, there needs to be a comma after it. > # FIXED: 2010-09-14 > > from appscript import * > > > bibdesk = app('BibDesk.app') > > union_tags = set() > > # Get the full path of the publications of the first Bibdesk document > cur_bib_publications = bibdesk.documents[1].publications.get() > for i in cur_bib_publications: > cnt = len(i.linked_files.get()) # maybe 0 to many linked files > if (cnt == 0): > # Skip if there are no linked files, there may be keywords! > continue > else: > # Create set that is a union of all linked files' tags > for j in range(1, cnt + 1): # 1-based indexing! > cur_pub_tags = i.linked_files[j].tags.get() > union_tags |= set(cur_pub_tags) > # Write the set in to the publication's keywords > if (len(union_tags) == 1): > # add a trailing comma if there is only one tag > i.keywords.set(unicode(', '.join(union_tags) + ',')) > else: > i.keywords.set(unicode(', '.join(union_tags))) > # Clear the set for the next publication > union_tags.clear() > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > Bibdesk-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/bibdesk-users ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Bibdesk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bibdesk-users
