Bookends, DT3, and annotations

I can’t speak to skimpdf as I don’t use it.

I have a lot of existing PDFs with highlights.

So you’re intending to end up with hundreds of individual notes??

So you’re intending to end up with hundreds of individual notes??

Well, yes. Up until now I’ve been keeping one document in DT per reference. The problem is visibility - I want to surface each of the difference notes.

Is there a way to iterate over PDF annotations/highlights in Applescript?

Or I guess as an alternative, is there a way to script the “Summarize Highlights” menu option? Extracting into a single note is probably better than not extracting them at all :slight_smile:

Sorry, but no you can’t access PDF highlights via commands in our AppleScript dictionary.

The application Highlights can do this, and it has links to Devonthink. Whether it will read your existing annotations is a matter for the usual ‘Which bit of a pdf will work for any given program on any given day’ lottery, but it may be worth a look. I don’t use it anymore (I use a modified script to take notes directly within DT) but I seem to remember it being useful. NB I haven’t tried it with DT3 yet!

There’s a demo available: https://highlightsapp.net

BTW — DT3 is amazing. And so is the Help file. Just wanted to say that. I’m greatly enjoying the new side-by-side view on my external monitor.

So, having tried out Summarize Highlights - it’s pretty awesome and does most of what I want.

And I’ve tried out the Annotation tool in the Inspector - also awesome because it’s integrated. Like others, I wish it supported Markdown! But I can see the long-term benefit of using the tool that is built in to DT instead of something external, so I reckon I will stick with that, and hope that I can switch to Markdown in the future at some point

And so is the Help file.

Woohoo!! :wink:

Which inspector actually - Inspectors > Documents > Annotations or Inspectors > Annotations & Reminders?

Both, but in this case I meant Inspectors > Annotations & Reminders. Being able to see the linked annotation in the pane to the right of the actual document is what I like. If there was a better way to pull out the PDF highlights & details (I guess via Summarize Highlights?) into the annotation document that would be even better.

(I guess via Summarize Highlights?)

Correct. :slight_smile:

I guess my ideal world the two would be integrated. Maybe that will come in the future!

I gave up trying adapt Bookends for my requirements, also gave up trying to use DT’s rather cumbersome (imo) approach.

For annotations and highlights in DT, my solution has been to tag each pdf where i have highlighted text with a unique number. I copy and paste the highlighted text to an rtf note and tag it with the pdf tag number. I create a smart folder search on the tag number: the name of the smart folder using the same name as the pdf for sorting. Hundred of individual notes yes, but each found at a glance.

It would be helpful if you could include a link to that script.

Along the same lines as my previous message, a link would be wonderful if that script is downloadable somewhere.

Ricki

It’s modified from a number of scripts written in 2014 by korm and then modified and developed by Frederiko (both of whose contributions are outstandingly helpful in so many respects. I’ve just butchered their work.).

There are two scripts, called by Keyboard Maestro to populate a dialogue box to enter variables which are then incorporated into the new annotation document. Unless you actually use Keyboard Maestro, the scripts themselves don’t work properly.

Basically, I select a pdf/rtf/webpage in DT3, optionally with some text highlighted and invoke the script to get this dialogue:

This creates the following document:

Bits to notice

  • the page number is attached to the source code and is prepended to the title (so you can sort references by page number. The ‘real page’ bit is to differentiate between pdfs which start on page 97 rather than 1 – the link goes back to the pdf page without bothering your written reference.

  • if you choose to make it an event, it brings up another dialogue with dates etc.

  • various group tags are added, and the annotation inherits those from the source doc.

As you can see, while its based on the marvellous work of frederiko and korm, it’s been heavily and clumsily hacked to fit my setup and workflow (e.g. the exact layout and fields in the dialogue box, the exact layout of the note document etc), and it absolutely requires Keyboard Maestro - I don’t think anyone could really just install the scripts without doing a fair bit of modification themselves first.

I am happy to post them, but I think both korm and Frederiko have moved on to other methods so there may be better examples out there. They are also very rough and ready because I know and work around the problems rather than fix them… :wink:

They would be useful to me, if don’t mind sharing them :wink:
I also use keyboard maestro. A lot.

See this topic.

I don’t mind at all… I’ll tidy them up slightly and do a small intro and then post them. Warning: they are very rough and ready, so it’s at the user’s risk!

1 Like

OK, here you are. First things first: many thanks to korm and Frederiko who are responsible for all the good bits in the scripts. I hope they don’t mind what I’ve done with it.

Secondly, the usual disclaimer before you use them: “Use at your own risk. I don’t know what I’m doing so these scripts will probably eat your files, your computer and your dog and it won’t be my fault because I’ve warned you not to use them unless you do know what you’re doing.”

There is one Keyboard Maestro Macro which calls two scripts.

The first (imaginatively called KM Citation Notes 1a (DB)) picks up various details from the currently selected DT document (name, page number etc) and stores them in variables for the KM macro to use.

The macro then calls a dialogue box for you to enter details, which are in turn fed back into the second script (KM Citation Notes RTF (DB) 6), which actually creates the new RTF annotation document.

(There are various versions of the macro and the second script, but they are very closely tied to my workflow and they’re a bit too specific to be generally useful, I think.)

To set up:

  1. Put the two scripts somewhere in your file system
  2. Import the macro into Keyboard Macro, then change the two Execute Script actions to pick up the scripts from where you left them.
  3. Change the KM trigger to taste (I run it off a palette, so can use a single letter trigger).

That should be it. Some things to notice:

  • it will add a leading zero to single figure page numbers (2 becomes p02) to assist sorting, but it doesn’t deal with 3 figure page numbers yet (99 won’t change to 099).

  • it will populate fields with previous values which is usually what you want, but occasionally isn’t, so check them before pressing OK…

  • if you highlight some text before running the macro, a citation section is created quoting the text you highlighted. Unfortunately the script mangles some characters (smart quotes mostly) in the quotations so you may have to make a couple of corrections. There must be a way of stopping this happening, but I don’t know what it is…

Can’t think of anything else at the moment. Hope it’s useful, but do search for posts by Frederiko and korm on annotations for their later developments.

KM Citation annotation scripts (DB).zip (26.5 KB)

1 Like

Much appreciated, Brookter. After taking appropriate measures to protect my dog, I’m going to look into using this.

Thanks for sharing your macro, @brookter! I am still thorn between using DT3 and Bookends for reading pdfs. Should I decide for the former, I will surely be using your macro to take notes.