But is there this one DT3-Bookends Script that I need?

There are a lot of scripts offered here for the DT-Bookends connection.

But does a script exist, that imports a paper’s reference from Bookends into the custom metadata in DT3? (pdf per pdf) I would like to use Bookends only for reference collection.

I don’t want to collect pdfs in twice (DT3 and Bookends), but only in DT3, but Bookends is much better for getting the reference in. Indexing is no option for me, either.

3 Likes

Not sure which script you’re looking for but this search should return all scripts for Bookends available on the forum:

https://discourse.devontechnologies.com/search?q=tell%20application%20%22Bookends%22

I need one script (or what ever would be possible), that imports the research paper´s reference data (title, author, abstract etc.) that are collected with and stored in Bookends to the metadata fields of the corresponding pdf in my DT3 database. (siehe picture).

As I said in the German version of this thread: how are you going to establish the correspondence between a bookmarks and a DT record? If that is clear, copying the metadata should be simple.

Most of the research articles have an DOI (Digital Object Identifier) or PMID (Pubmed-ID).

One of the links in the list cgruenenberg recommended seems to do what I need, but it needs the exiftool to be installed and that DT3 indexes the Bookends database. I have no experience with exiftool and don´t want the indexing part. Is there any other way of doing this? Actually I have no experience with Scripts, but if it’s necessary I would learn it.

I suggest that for the benefits of others we keep the talk in this thread and drop the German version.

So, in my words

  • you have PDF documents in DT
  • these documents have a DOI or PMID in their user metadata
  • also, you have corresponding bibliographical information with the same DOI/PMID in Bookends

Then a script would go over the selected records in DT one by one, take their DOI or PMID (whatever is available), ask Bookends for the metadata for this DOI/PMID value and enter those values in the DT record’s user metadata.

Is that about right? Then I don’t see the need for exiftool.

In case of documents having a DOI the smart rule script to download bibliographical metadata might be useful.

Where do I find this?

Here’s a JavaScript script that might help. It works with the currently selected DT records and should (!) be able to be used in a smart rule after minor modifications.

(() => {
const bookapp = Application("Bookends");
const dtapp = Application("DEVONthink 3");
dtapp.includeStandardAdditions = true;

const records = dtapp.selectedRecords();
records.forEach(r => {
  /*
  * Look for DOI in metadata. If not found, look for PMID */
  let id = dtapp.getCustomMetaData({for: "DOI", from: r});
  if (!id || id === null || id === "") {
    id = dtapp.getCustomMetaData({for: "PMID", from: r});
   }
   /* if neither of them are found, skip this record */
  if (!id || id === null || id === "") {
	return;
	}   
  /* Find corresponding items in BE */
  let items = bookapp.libraryWindows[0].publicationItems.whose({_or: [ 
    {doi: id},
	{pmid: id}]});
  if (items.length < 1) {
    dtapp.displayAlert(`No entries found in Bookends for "${id}"`);
	return;
  } else if (items.length > 1){
    dtapp.displayAlert(`More than 1 entra found in Bookends for "${id}"`);    
	return;
  }
  /* exactly one matching entry in BE found, make a copy */
  const item = items[0];
  /* Copy metadata from BE to DT */
  dtapp.addCustomMetaData(item.authors(),{for: "Autoren", to: r});
  dtapp.addCustomMetaData(item.abstract(),{for: "Zusammenfassung", to: r});
  /* repeat for all other metadata, might require some mangling for volumes etc. */
})   
})()
2 Likes

Create a smart rule, select “Run Script” in the actions part and then choose this script, I guess.

2 Likes