Linking attachments by name

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
doconnor
Posts: 12
Joined: Sun Nov 27, 2005 7:50 pm

Linking attachments by name

Post by doconnor »

NCBI asks that their FTP Service be used when batch downloading manuscripts from Pubmed Central (https://www.ncbi.nlm.nih.gov/pmc/tools/ftp/). I wrote a script downloads all the PDF files from Pubmed Central that match a given set of search terms from the FTP site and creates a medline-formatted file of these references that can be imported into Bookends. Because there may be hundreds (or more) matching records, hammering PMC through the Bookends Online Search seems like a bad idea.

What I'd like to do is link the downloaded PDF attachments to the references by name -- the PDF files have names like "PMC5382433.pdf" that have a 1:1 relationship with a PMCID in the citations list.

When I try to link the local PDFs with the list of citations using the 'Find and Attach Local PDF' option, some PDF files fail to link and others link inappropriately to more than one citation. Is there any way to associate attachments with references by name instead of by scanning the contents of the PDF?

UPDATE: I tried solving this with Applescripting / Apple Events. I think I'm close, but not quite there. I can get a list of all the unique IDs in my reference library and extract the PMCID field value. The next step is to add an attachment to a record based on the PMCID. When I set the attachment field to the path of the file, Booeknds creates an attachment internally (as indicated by a paperclip next to the reference and an attachment not found indicator in the inspector). But Bookends can't find the file.

For a single record, I'm trying:

Code: Select all

set PMCID to «event ToySRFLD» uid given string:"user16" --user16 is bookends's location for PMCID
event ToySSFLD» uid given «class FLDN»:"attachments", string:"/path/to/file/dl/" & PMCID & ".pdf"
The documentation describes adding an attachment to a blank record based on its POSIX path with «event ToySADDA». I think I need to do something similar, but associate the attachment with an existing record. Is there a good way to do this?

Thanks!

dave

Post Reply