EDITThe problem arose from having several DT windows open at the same time. Since the thread might still be interesting for others, I’ll leave it as it is.
I have a single PDF record with an annotation (not a PDF annotation, though), namely a link to another DT record (an e-mail). So, the annotation inspector shows the title of this record as a link, and when I click on it, the e-mail is opened. Also, the database’s annotations group contains an RTFD record with this single URL as a link. So far, so good.
Now, with this PDF record (i.e. the annotated one) selected, I want to get all the records in the corresponding annotation group:
(() => {
const app = Application("DEVONthink 3");
const r = app.selectedRecords()[0]; /* get the currently selected record */
const annotation = r.annotation(); /* returns undefined because its a PDF? */
const annGroup= r.database.annotationsGroup(); /* get the annotation group for the record's database */
console.log(annGroup.children().length); /* returns 0 - WTF? There is one record in this group and I can _see_ it */
})()
So, annotation()
of a non-text record does not work (as per the documentation). But shouldn’t the database’s annotationGroup
behave like any other group and tell me about its children? I checked that the type
of annotationGroup
is indeed “group” and that the group has a UUID.
And group.children().length
on a “normal” group works just fine, BTW.
I’m probably doing something stupid here. But what?