I have a big EagleFiler archive in which I hold all of my PDFs, and as I add papers, I generally fill the “Title” field with the paper title and the “From name” field with the authors, as well as assign tags, etc. EagleFiler is generally my first stop when I acquire a new PDF. Plus, my EagleFiler library lives in my Dropbox, so I can get at these files from my iDevices as well.
However, when I want to add one of these papers to my bibliography, I have to go to BibDesk, make a new record, retype the title and author, and attach the PDF. And then I think: I should automate the export of the metadata someday.
Happily, that someday is today.
I have put together a simple Applescript that will look at the record(s) selected in EagleFiler, and create a corresponding new BibDesk record for each of them. It fills in the title, author, and source URL information from the EagleFiler metadata, attaches the file to the BibDesk record, and then does a couple of other things that are idiosyncratic to my particular filing system. In particular, it looks in the path to see if it is inside a “Journals” folder (in which case it is an article), or in “Monographs” (in which case it is a book), etc. It also looks to see if a tag called “look” was assigned in EagleFiler, and marks the “Read” flag in BibDesk if the tag is found. Obviously, these parts are only useful if you file things the way I do. But even if you don’t, it might be interesting to see how the script works.
I am no Applescript genius. In my initial tests, this ran kind of slowly, and there are probably better or more efficient ways it could be written, but it does seem to work.
Once a BibDesk record is created, the publication window is opened, and generally there needs to be some tweaking: fixing quotation marks, protecting capitals, fixing author lists to use “and” as separators, but it still saves some double-entry.
One installs Applescripts like this into
~/Library/Scripts/Applications/EagleFiler and then they are available via the scripts menu in the menubar.
-- Create a new BibDesk record from EagleFiler record
-- Paul Hagstrom, November 2010
-- This is probably kind of idiosyncratic.
-- My filing procedure is to have PDFs in EagleFiler with the
-- title in title
-- authors in from
-- There is very little chance that it will work without any need to edit
-- Maybe later I'll try to figure out how to tag things so that they'll
-- detect the right reference type, etc.
tell application "EagleFiler"
set _records to selected records of browser window 1
repeat with _record in _records
set theTitle to _record's title
set theAuthor to _record's from name
set theSource to _record's source URL
set theFile to _record's file
set thePath to theFile's POSIX path
set theNote to _record's note text
-- special handling based on my idiosyncratic organization
-- look at the path to see if it is a journal or what
set theType to "article"
if thePath contains "Journals" then
set theType to "article"
if thePath contains "Monographs" then
set theType to "book"
if thePath contains "Dissertations" then
set theType to "phdthesis"
if thePath contains "Edited" or thePath contains "WPL" or thePath contains "Conferences" then
set theType to "incollection"
-- special handling of tags. If something is tagged "look" it goes on the reading list.
set theRead to false
set _tags to _record's assigned tags
repeat with _tag in _tags
if _tag's name is "look" then
set theRead to true
tell application "BibDesk"
tell document 1
set thePub to make new publication at the beginning of publications
set type of thePub to theType
set title of thePub to theTitle
--at some point I might try to replace commas with "and"
--and if theAuthor starts with "ed." put it in the editor
--field instead, since that is my general convention in EF.
set value of field "Author" of thePub to theAuthor
add (POSIX file thePath) to beginning of linked files
if theRead then
set value of field "Read" to 1
make new linked URL with data theSource at end of linked URLs
--at some point I might try to parse my filenames
--they are generally authorYear-source.pdf
--set value of field "Journal" to theJournal
--set publication year to theYear
set cite key to get generated cite key