"Latest Version Of" Tag

If anybody could help me write the following script, it would really help me a hell of a lot. I’m a writer with a lot of projects going. I try to stay consistent with version numbers of my documents and so on, but then I find myself getting jumbled up when I email versions to people, sometimes with quick minor tweaks – tweaks I’m not sure I’ll keep in my own latest version. So I sometimes have multiple versions of a document that are almost identical, and I’m not sure which is, for me, the “latest version.”

I’ve tried tagging documents “Latest Version,” but then, no big surprise, I end up with multiple documents with that tag.

I’d like to write a script that will designate one document, and one document only, as the “Latest Version of [X].”

Details: I write novels, screenplays, and TV scripts. So, say I have a writing project called “Caveman” with the following structure:

(Bold = Group)
(Bold and Underlined = Group with DEVONthink label “Writing Projects”)


  • Novel
    ---------- (several documents)
    Versions sent to Larry
    ---------- (several documents)
  • Movie
    ----- Cavemen with clubs
    ----------“DOC 1”
    ----- Cavemen with spears
    ----------“DOC 2”

This is what I want the script to do:

(1) for the selected record, add the tag “Latest Version of X - Y - Z,” where X, Y, and Z are all the groups that are labeled “Writing Projects” and contain the record.

(2) find the previous record that held the “Latest Version of X - Y - Z” tag (under the same final “Writing Projects” subgroup) and remove the tag from that older document.

So, in the example above, if DOC 1 was the previous tagged document, and I ran the script on DOC 2, then the script would tag DOC 2 with “Latest Version of Caveman - Movie.” And then (or before) it would remove that tag from any other documents under “Movie,” including DOC 1.

Note that DOC 1 and DOC 2 are in different groups, but under the same “Writing Projects” group – it’s important for the script to differentiate between labeled and non-labeled groups. I need just one “Latest Version” under “Movies.”

Whoever can help me, a million thanks in advance.


Did you have a look at the versioning scripts posted here? viewtopic.php?f=4&t=2076