Stream annotations from your PDF reading sessions with DEVONthink
# Stream annotations from your PDF reading sessions with DEVONthink
One thing that makes PDF annotations extremely valuable is that they can be extracted.
A variety of apps and services have popped up to support this: PDF Viewer, Highlights, PDF Expert, and DEVONthink all let you review and even export PDF annotations into text you can manipulate with, say, your favourite Integrated Thinking Environment.
In recent years, however, we’ve seen some tantalizing new services that offer to do more with your annotations. Readwise, Memex, and Remnote offer ways of taking annotations out of our readings and putting them directly into our notes—automatically! What a world we live in.
I wanted a way to do this with the tools I already have. I also wanted it to be extremely customizable. So, I have crafted a workflow to “stream” the annotations from my PDF reading sessions using DEVONthink and AppleScript.
Here’s what it looks like:
Here’s what it does in practice:
- You open a PDF in DEVONthink on your favourite device. (Feel free to open it in your favourite PDF reading app.)
- You annotate the PDF as you read.
- Fifteen minutes1 after you last modify the file (e.g., after you add an annotation), DEVONthink creates a “Reading Session” note with the new annotations in whatever folder you want.
That’s it! Of course, it’s still up to you to do something with those annotations.
Here’s how it works:
- A DEVONthink Smart Rule watches for PDFs with annotations that were recently modified. If it finds any, it tries to execute the script.
- By using DEVONthink’s custom metadata, the script double-checks that (1) the file’s content has actually changed and (2) the number of annotations has increased.
- It then uses DEVONthink’s Summarize Highlights feature to export the PDF’s annotations, and then extracts only the newly-added annotations from that file into a Reading Session note.
# Setting up the automation
- DEVONthink 3 Pro. The script uses custom metadata, which is only available in the Pro edition.
- Download the “Automatically extract reading session annotations” script.
- Open the script file and configure it according to the instructions at the top of the file.
- In DEVONthink, open the Script menu (just to the left of Help in the menubar), and select “Open Script Folder.” Place your newly-downloaded script in the Smart Rules folder.
- Quit and relaunch DEVONthink. This will ensure DT3 “recognizes” the newly added script.
- Download the “Extract reading session annotations” Smart Rule. When you open this file, it should add a new Smart Rule to your DT3 Smart Rules that looks like this:
- Configure the Smart Rule to your preferences, as desired. (E.g., you may not want this rule to work on all PDFs in all databases, in which case you should tell it to only look for PDFs in a particular database or group.)
- Make sure the Smart Rule’s action is “Execute Script -> External -> _Automatically-extract-reading-session-annotations”. (You may have to select this manually.)
- Start annotating PDFs and, fifteen minutes1 after you’ve added some annotations, you should see a new Reading Session note get created!
# Some assumptions:
- DEVONthink 3 Pro has to be running on a Mac in order for the script to trigger.
- Annotations are added sequentially. The script will not work if you go back and add annotations earlier in a PDF. E.g., it won’t automatically extract annotations added on page 1 after you’ve already highlighted something on page 2.