On 17 Oct 2008, at 7:36 PM, Eric Carlson wrote:
I'm trying to write an applescript for bibdesk to assist with my
migration from jabref. Here are my questions in brief, with more
1) Is there a way to convert Bdsk-File references to paths from the
command line without having to have BibDesk open?
No (unless you can program).
2) Is there a way to add new fields to references using applescript?
(Or at least make bibdesk actually save custom bibdesk fields, even
though they're currently empty?)
Empty fields are not saved (well, there's a limited way through a
hidden preference to save specific empty fields). Generally, bibtex
and bibdesk treat empty fields the same as missing fields anyway.
3) What is the syntax for removing a field or linked file using
You remove a field by setting it to an empty string, and a linked file
using the "remove" command.
I have other perl scripts that I've written when I was using jabref
that need to determine the paths to linked files for each bibtex
entry. In jabref, there is a "File" field added to each entry whose
value is a list of the format
don't mind modifying my script, but can't figure out how to convert
the Bdsk-File references into useable posix paths from anything
accessible to perl (e.g. perl itself, or anything from the command
line). My next idea was to have an apple script callable from
Bibdesk that would make an appropriately formated line based on the
currently linked files, and set the "File" field to that. This
works for entries that already have a "File" field, but not for new
entries. I tried adding "File" as a custom bibtex field and making
it default, but it seems to not actually be created and accessible
to applescript unless the user (me) manually goes and enters
something in it, which is time-consuming for a large number of
entries. I've tried adding a new file using the following syntax,
but haven't been able to get it to work, and can't find documentation:
make new field "File" at end of fields of thePub
You don't use "make", you just set it's value. As I said, BD treats an
empty field the same as a non-existing field, so every potential field
already exist and has value "" (just try it).
I've tried looking at the source code, but it seems that I need to
pass a nsstring name and a bibitem, and I haven't had any luck
creating a bibitem, either.
Items are just created using "make", as in "make new publication at
beginning of publications". Have a look at the sample script (option-
click the menu item in the BD script menu).
Lastly, can someone fill me in on the syntax to remove fields or
linked files? I had originally been automatically creating ps files
with notes for my references,
For fields, you just set the value to an empty string. For linked
files, use the "remove" command (and create new ones using "add").
and changed my program to create pdfs instead. This made all of the
ps linked files invalid, but I couldn't remove them, and have too
many files to go
through by hand. I finally reverted to an earlier version of
my .bib that hadn't been linked to external files, and relinked, but
would like to know how to
remove files for the future. I had tried something like "remove
linked file lf from linked files of thePub" but had no luck.
This works, as long as "lf" is not evaluated (because than it's the
file object rather than a linked file object, and has no reference to
it's item anymore). Note that an assigment to a variable in AS usually
evaluates. So either make sure it doesn't (using "a reference to"), or
just pass an explicit reference (like "linked file 1 of thePub").
Thanks in advance,
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
Bibdesk-develop mailing list