Reading DT3 annotations through the scripting interface

How, if it’s possible, should we read annotation properties through the scripting interface ?

I have before me a PDF record which, following some text annotations in DT3, has a populated Annotations panel, and returns the value 9 for the following AppleScript snippet:

tell application "DEVONthink 3"
    tell front window
        tell content record
            annotation count
        end tell
    end tell
end tell

In the annotations panel, we can see these nine items:

How, if at all, can we read their properties (e.g. text) by script ?

You can get the annotations’ properties with the class PDFAnnotation from the PDFKit framework using the ObjC bridge. I’ve posted some code in this context here recently.

But: afaik, highlighted text annotations have no text property, only bounding boxes. Which might make it possible to retrieve the text, but I doubt that it’s a fun exercise.

1 Like

Thanks – thats’s helpful.

And what do we think is the role of the annotation property of record objects in the DT3 OSA interface ?

(It seems to return an empty value in this context)

Screenshot 2023-02-01 at 18.30.09

That’s the standalone annotation record, not an PDF’s annotation.

2 Likes

Quoting from the scripting dictionary:

annotation [Record] : Annotation of a record. Only plain & rich text and Markdown documents are supported.

1 Like