Connecting and automating DEVONthink, Bookends, and Obsidian
# Connect DEVONthink PDFs, Bookends references, and Obsidian summary notes with this script
Feb 9, 2021: I’ve updated the script to catch a few issues and to clean up the output (by removing critic markup using a find-and-replace method).
DEVONthink is where I keep all of my, well, everything. DEVONthink’s item links use a universal unique identifier1 (UUID) to allow robust deep-linking to every kind of file you can throw at it.
(It might be more useful to extract what I haven’t highlighted, sometimes.)
DEVONthink is also a great way of engaging with the data you capture about these files. For example, its “Summarize Highlights” feature will extract annotations—such as your highlights—from a selected PDF into markdown, RTF, or PDF format. DEVONthink also has a built-in annotation feature. This creates a note file specific to whatever file you’re currently viewing so that you can annotate it yourself.
However, by default, these two features are separate. I wanted to extract a PDF’s annotations in markdown (e.g., everything I’ve highlighted or commented on) and add those thoughts automatically to the DEVONthink annotation file for the PDF.
I also wanted to link these files together with Bookends. Bookends is a Mac/iOS reference manager of choice (once you’ve got your references imported). It is extremely performant, even with thousands of references, it has a variety of powerful features, and it has excellent macOS integrations (e.g., it is highly scriptable).
Last, I wanted to be able to open and work with these annotation files in Obsidian.
So, I created a script that does all of the above!
Select a PDF in DEVONthink, then run the script. It will:
- Check if the file has data in the “bookendsID” custom meta data field
- If not, it will prompt you to select the appropriate reference in Bookends (if desired)
- Then, it will place the DEVONthink item UUID in the user20 metadata field of Bookends, and place the Bookends reference ID in the “bookendsID” custom meta data field of the record in DEVONthink
- It will then run DEVONthink’s Summarize Highlights feature on the PDF
- If annotations are found, it grabs the summarized annotations and places them in the PDF’s annotations file
- If not, it just creates a blank annotations file
- If possible, it then appends a link to the Bookends reference at the bottom of the file
- Last, it moves the annotation file to a specific folder so that I can view and open it in Obsidian.
# Requirements:
- DEVONthink 3 Pro
- Bookends
- Some way of running the script
# Set up:
- Customize the UUID fields in it to refer to your databases/destination groups
- In DEVONthink 3 Pro, create a custom meta data field in Preferences → Data with the key
bookendsID
- In Bookends, make sure you’re not using the
user20
field for anything else
# Link DEVONthink and Bookends and extract PDF annotations for use in Obsidian
I also include two helper scripts that use the custom metadata in DEVONthink and Bookends to open the relevant item in the alternative app
# Open a Bookends reference from a DEVONthink item with a bookendsID
Download the “Open Bookends reference from DEVONthink” script
# Open a DEVONthink record from a Bookends reference with a DEVONthink UUID
Download the “Open DEVONthink record from Bookends” script
-
Or unique universal identifier? Choose whichever order you prefer, I guess! ↩︎