Tag duplicates of one document automatically

I’m new to Devonthink, and I didn’t find an existing script/trick that accomplished this yet.

Basically, is there a script - or is it possible to create one - that lets you tag/label/comment on a document, and then that tag/label/comment is automatically copied onto all duplicate files?

I gather that you could manually select all the duplicates, but I was curious if there was a way to automate that.

While it is possible…

  1. You don’t have the advantage of Tag autocompletion.
  2. You are outlining more than one property, which requires either multiple dialogs, are entering and parsing the entry for each value. For example: New Tag : 3 : This is a comment would need to be parsed to pull the disparate parts for applying to the file(s).
  3. What you are referring to is accomplished automatically with Replicants. Changes to one instance of a Replicant propagate to other instances.

For a simple bit of code (for interested parties)

tell application id "DNtp"
	set newTag to ""
	repeat until newTag ≠ ""
		set newTag to (text returned of (display dialog "Enter Tag:" default answer ""))
	end repeat
	repeat with thisRecord in (selection as list)
		set tags of thisRecord to (tags of thisRecord & newTag)
		repeat with dupeRecord in (duplicates of thisRecord as list)
			tell dupeRecord to set tags to (tags & newTag)
		end repeat
	end repeat
end tell

This will apply an entered Tag to a selected record and its duplicates. Obviously extensions could be made. :smiley: