Template scripts for Annotation templates?

In DEVONthink 3.7, is it possible to create annotation templates that are scripts, like other templates can be? I.e., would creating a .templatescriptd type of template work for an annotation template placed in the Annotations.noindex directory?

No, smart templates aren’t supported as Annotation templates.
To what end?

To what end?

Here are two reasons:

  1. DEVONthink supports a number of template placeholders, but there are still other things I’d like to put into an annotation template for which there are no predefined placeholders. For example, if I wanted to create an annotation template in markdown that included the highlights from a PDF being annotated, the only way to get the annotations is currently to use the AppleScript command summarize highlights of. I could implement some AppleScript code to create a custom placeholder if annotation templates could have the same form as regular templates.

  2. I use Zotero for reference management, and I index my folder of Zotero papers using DEVONthink’s indexed folder mechanism. I also use a software utility I wrote (Zowie) to write the Zotero record URI for each PDF file into the Finder comment of the PDF file, which makes it accessible from DEVONthink. I would like to write an annotation template for reading notes, and create a custom placeholder to insert the Zotero link into the annotation document.

Those are two limitations of the current annotation scheme in DEVONthink that could be remedied by allowing annotation templates to have the same scriptable form as the other templates.

Sounds like things very custom to your setup. Development will have to assess the feasibility and broad appeal of this. Thanks for your patience and understanding.

Perhaps it seems like this is a custom/advanced use case, but on the other hand, I think it could be argued that the current arrangement in DEVONthink is conceptually inconsistent. Here’s why. Non-annotation templates can be single files, or template packages, or smart templates, and the user manual describes how they work. The manual even suggests inspecting the sample “Project” smart template for ideas and inspiration. So, when creating an annotation template, it doesn’t seem unnatural to think they could be like any other kind of template in DEVONthink – either a single file, or a template package, or a smart template. But currently, they’re not. The situation feels like an exception (“you can do such-and-such here but you can’t do it there”), which usually leads to more complexity for users and often more technical debt in the software implementation.

Anyway, thanks for considering it!


I agree fully with your questions / needs @mhucka. Wondering how you’re currently solving this. I’m thinking of an alternative approach circumventing the default way to create annotations, but rather always creating them via Applescript. My main ‘problem’ is how to do that on mobile. But I’m thinking that could be solved with iOS shortcuts because basically all my Annotations are Markdown files on iCloud.

Can you clarify what you mean by this, including screen captures, if possible?

@BLUEFROG there’s nothing really complex: I basically use Markdown files as annotations for clipped web content (as PDFs). So every PDF has basically an accompanying .md file. In the screenshot they’re all in the same folder, but I’m moving them out to a separate folder. I’m using my annotations also in my Obsidian vault as a starting point for writing notes.

Thanks. That’s helpful to see (and needn’t be complex) :slight_smile:

So you’re using DEVONthink’s Preferences > General > Annotations: In same group ?

Yes, I am now (these annotations were created outside of DT btw), but I’m going to move to “In shared group”. I had hoped it would also work with an Indexed folder “Annotations” but unfortunately that doesn’t seem to work.

What part doesn’t seem to work? It seems it should, technically speaking.

I’ve added an Indexed folder named “Annotation”, but when I’m creating an Annotation via Annotation → New from Template it creates the annotation in a new non-index group with the same name (see screenshot)


With some more experimenting the following workaround works:

  1. Create an indexed folder
  2. Move the Annotations folder created by DT to the indexed folder (deconsolidate)
  3. Move the Annotations folder out of the folder from (1)

Now new Annotations will show up in the indexed folder “Annotations”

I’m trying to set my annotations folder to an indexed folder in the root of my database, but I can only get it to work as a subfolder of an indexed folder. Is this possible in any way @cgrunenberg?

That’s not possible, the only way to convert internal items to indexed items is to move/create them to/in indexed groups.

This is sounding like a bad idea, in general.
It’s best to leave things where DEVONthink puts them for best performance, to avoid unexpected problems from unsupported behavior, and to not flummox support who will not know things are not set up in the default way.