Integration of DTP3 with Bookends

I have been using DTP with Bookends for ages, using DT to process PDF files (that start as photographs of documents from archives) before dropping them into Bookends, where I enter bibliographic data and take notes, usually quotes from the PDFs. Sometimes, when searching for something, I have gone back to the original PDFs, which are left in DTP databases (as well as being in the Bookends Attachments folder), done searches, and when I have found something useful, I have then had to identify the document manually in Bookends. But aside from this, once something is in Bookends, I do not go back to DT.

However, recently I have been thinking I should make greater use of DT’s searching, which clearly beats Bookends. So I used the Import from Bookends option, which appears to be just what I want, except for two things:

(1) If I make new notes in Bookends, I cannot see how I can update the entries created in the Bookends folder in DT, short of deleting and importing again, which does not seem the right way to go. There must be an easier way to do the updating, even if it means re-importing and then deleting duplicates and flagging ones that look as though they might be duplicates that have been edited in Bookends since the last import.

(2) More important, although the Bookends references are each linked to a PDF attachment, the only way to see the attachment is to click on the “title bar” (not sure what is the correct term) which takes me to the reference in Bookends. Not nearly as efficient as having the attachment indexed in Bookends. I Indexed the Bookends Attachments folder, but although I can search Attachments and search the Bookends data folder, the problem is that the attachments and the Bookends data are not linked, so if I choose a hit from searching the attachments, I have no idea what the bibliographic data are. I guess what I was hoping was that, given that Bookends does link each reference to attachments, the entries in DT would link to indexed versions of the attachments, somehow.

Sorry this query is so long, but though I have an idea about what I want to do, I am not clear on how I want to do it or what might be possible. I found some scripts on the forum which looked useful, but I could not work out how they worked (I am not skilled in reading Apple scripts). If a Bookends user could point me in the right direction, that would be great.

1 Like

As you’ve discovered, there’s a lot on this in the forums here and on Bookends’ forums.

Because each person’s setup is so particular, you might want to try figuring out the way each script works in order to find one that suits your tastes. It might be arduous, but these scripts can be kinda dangerous (in that they often involve the moving/modification of files/data).

Otherwise it is hard to diagnose your particular needs and provide a prescription!

That said, I’ll try. It sounds like you just want the Bookends attachment folder to be indexed, and for the resulting records to be linked between Bookends and DEVONthink 3. This will lead to live-updating of on-PDF annotations. It will also leave Bookends to manage the reference metadata and DT to manage the content.

I can’t recall if it exists already, but you’re probably looking for a script that simply adds a DT item link to those Bookends references that have been indexed and a Bookends ID link to the corresponding DT record, making it easy to jump back and forth.

(This should be possible in scripting by matching a Bookends item’s path with the DEVONthink’s item’s path, so I imagine it exists.)

Has anyone tried Hook. The latest update (1.5.1 I think) enhances the links with DEVONthink. I am going to try it with Bookends because, like you, I use both.

Thanks for the suggestion of Hook. I will explore it. I didn’t know about it.

In response to ryanjamurphy, The built-in command File/Import/References from Bookends does a good job of creating a file in DT for each reference in a Bookends Group. It contains a URL that goes back into Bookends, which is great. But it would be even better if, when a reference has an attachment, that attachment could be referenced directly from DT, so that a search within DT would search the text in the attachment, as well as in the reference data, and when it found a match in an attachment, this was linked to the correct reference. (Does that make sense? I am struggling to get the right terminology.) The Bookends fields include “Attachment file name” and “Attachment path” so presumably the necessary data is extractable.

I found one thread with some scripts on, but I will search for others. I don’t have the knowledge (or the time to develop the knowledge) to write scripts from scratch, but I might be up to modifying one someone else had already got working.

Thanks for the warning that scripts from the forum could be dangerous. I deliberately created an empty DT database, and did two backups of my Bookends database before experimenting. I hope that is cautious enough.

Solved one problem by reading the manual. “Import from Bookends” updates references that already exist. Sorry to anyone who wasted time reading that bit of my query.

I have written a number of scripts that link DevonThink and Bookends. You will find many of them in this forum or on the Bookends forum. They are also found at this link. Additionally I am using the following script, that I launch from Alfred, to jump from Bookends to the corresponding PDF in DevonThink. The script only works if the Bookends attachment folder is indexed in DevonThink and that folder is the active group in DevonThink. This script does not require any URL linking between the two programs.

tell application "Bookends"
tell front library window
	set theRefs to selected publication items
	set theItem to first item of theRefs
	set theName to name of attachment items of theItem
end tell
end tell

tell application id "DNtp"
-- Change "/Bookends" and "Research" to the name of the indexed Bookends folder
-- Change "Research" to name of the Database containing the Bookends folder
	set theRecord to get record at "/Bookends/" & theName in "Research"
	set root of viewer window 1 to (root of (database of theRecord))
	set selection of viewer window 1 to (theRecord as list)
end tell
1 Like

Thanks for this link. For me, the Annotations and Reading briefs work though they do things I am not sure are useful to me, but with the others I see no evidence of anything happening when I run them. I am not clear what data you store in user1. I use user1 for something else, but though it would be trivial to edit the script to point to a field I don’t use (e.g. user2), I am not clear about what I need to put in there. I assume the absence of suitable data in user1 may be the reason why nothing appears to happen. I have installed exiftool, though I have no idea whether it is working.

On terminology: DEVONthink items are usually “records,” and Bookends items are usually “references.”

As far as my understanding goes:

  • Import from Bookends creates (or updates) DEVONthink records containing Bookends’ metadata for references
  • Indexing the Bookends attachment folder in DEVONthink “creates” DEVONthink records corresponding to each attachment in Bookends

So if you do both of these actions, you actually have two DT records representing the same PDF, yes? And your goal is only having one, but still having the same data available (PDF and reference metadata) in that one record?

Yes, that is correct. I have two folders, one labelled attachments and the other labelled Bookends, which refer to the same PDFs. My motivation is that DT’s searching is potentially more powerful than Spotlight’s (used by Bookends), and it might be easy finding multiple connections between documents using DT than having a massive list of Groups in Bookends.

Sorry for another question about the Import from Bookends command. It prompts you to select a Bookends Group from which to import, but I cannot see whether it preserves information on the Bookends Group that is chosen. Of course, if it does not, the workaround is trivially simple: go into Bookends, select all references in the Group and give them all a suitable keyword before Importing into DT. Keywords can then be converted to tags in DT, and used to form DT smart groups. But it was a surprise that the import command did not store this information somewhere.

Regarding integration with Bookends, have you looked at DT3 for Historians?
which was mentioned in a recent DT3 newsletter.
I’ve just bought their Super User module because it wasn’t expensive and includes scripts to enter references in Bookends directly from DT3. I haven’t set it up yet, but it looks promising.

The scripts detail what is required, for example some require custom metadata to be set in DT3. User1 in Bookends is dedicated to the Bibtex key. The linking script, between DT3 and Bookends will place a DT item link in User4 in Bookends and a Bookends item link in the URL field in DT

Thank you for this. I had not encountered this site. Your link gets me to the page about DT for Historians, but when I click on the link that page contains, I get a “502 Bad Gateway” message. I would be interested to get hold of this. When I started using DTP, I was surprised not to find anything about such workflows on the web and developed my own. This might be what I am looking for. It might even answer the question I am in the middle of composing about the best way to reorganise my database.

Thanks. I am pretty sure I use user1 and user4 for other things, and would need to move that data somewhere else. Since I posted, I have found that the BibTex key is something created by Bookends, and so presumably I have no choice but to have it in user1 and move my own data elsewhere. I guess I could edit the macro to change user4 (which I also use) to another field. However, one feature of Bookends that puzzles me is working out which user fields are free and which are used by Bookends for something, and which ones I can use for whatever I want.

But right now I am thinking that I may have to reorganize my databases before I sort this out. Hopefully worth it in the long run.

I just tried that link again. It works for me.

Thank you. It works for me too now. Sorry if the problem is that I do not know how to tell which error messages denote a temporary problem and which a permanent one. Or maybe the authors responded to my message and fixed something.

DT for historians does look interesting but they ask you to take a lot on trust when purchasing. If I was starting from scratch I would probably take a gamble and purchase right away. However as I need to do something compatible with the way I handle archival sources at the moment, it is not clear to me that it will be useful. The one thing it tells me that their macros cover is how to enter bibliographic data in DTP, and then upload it into Bookends. But I am not clear why this method would be quicker than doing the data entry in Bookends (my current practice), and also whether it would be compatible with the way I have already entered upward of 20,000 references into Bookends. Maybe I will contact the authors.

1 Like

Maybe I will contact the authors.

That would be a good idea. They’re both very nice people. :slight_smile:

1 Like

Don’t bother with DT3 for Historians , its just that - I work in biological sciences and found it useless.
If you’re on this forum then you’re already way ahead of what’s in that course
and the script they include is basically the same as that in DTO already

Thank you, JPC. I don’t understand half of what I read in the forum. I have already bought the course, so maybe when I have time to get into it, it will get me up to speed.

That’s no problem as you can always ask. In case no one replied just ask again after some time. That will bring the thread back to the top which makes it likely that someone answers your question.