Efficient group/tag assignment - suggestions?

I want to put my documents into a group structure with many replicant instances (for now, let’s not debate whether this is good practice). For example, for my research, I want to replicate a single document into several categories: (1) the relevant project (2) the topic(s) covered (3) technique(s) described in the paper, (4) special tags such as “good intro for my students”, “follow up” etc. In short, typically I have to replicate a file coming from the inbox into a handful of categories, sometimes more. Here is my problem: I have to do this by

(1) cmd-opt dragging the file over and over again into the suitable groups/tags on the left side of the DB window or the Groups & Tag window.

(2) repeatedly using the contextual menu “replicate to” and following the hierarchical menu to my destination.

Both methods are not satisfying if you have several replications to make per file.

I have been trying to come up with better ways of assigning groups/tags. Here is what I think would work well, at least for me: Select an item, then launch a contextual menu item “assign replicants”, which would bring up a window that contains the whole group/tag structure. Each group/tag has a checkbox next to it. I can then go one by one through the list and check all the groups/tags that apply. I can make corrections, and I don’t have to hold cmd-opt all the time. When I am finished, I will press an “assign” button, the window will vanish, and all replicants have been assigned.

Do you also think that this would be the best technique for making multiple replicants for a single item? Or do you have better suggestions? Something that already is implemented?

Something like the checkbox approach might not find its way into the main DTPO, but would it potentially be doable in AppleScript? Not at my current proficiency, though.

Feedback would be welcome.

P.S.: There are standalone programs, e.g. “Keyword Sidekick” that put a list of keywords onto the clipboard after selecting them from a list. One could re-create the DTPO group structure in KS and then copy the list into the tag window in the DTPO inspector, but that’s not very elegant.

Typical… Once I post something, I shortly afterwards find a solution. Almost, at least.

User cturner posted a script in 2009 ( Replicating by default ). One selects an item in the DB window, and then selects multiple groups in the Groups & Tags window; running the script will then replicate the item into those groups.

I just tried the code. It works, but only when the selected groups are (1) at the top level of the DB, and (2) have no subgroups. I’m not familiar with the DT-specific operations, and I haven’t been able to figure out what the problem might be.

If someone can quickly spot a problem, please let me know.


-- orginially posted by cturner in 2009
-- https://discourse.devontechnologies.com/t/replicating-by-default/8122/1

-- Takes possibly multiple source selections in a DTPO database,
-- and possibly multiple selections in the "Groups" window;
-- then replicates source to targets.


-- GG, 01-Jun-2014 - renamed "Groups" window to "Groups & Tags"
-- so far only works for when selecting top-level groups that also have no subgroups
-- selecting a subgroup or a group that has a subgroup results in an error message


tell application "System Events"
	tell process "DEVONthink Pro Office"
		set selState to selected of rows of outline 1 of scroll area 1 of window "Groups & Tags"
		set selName to value of text field 1 of rows of outline 1 of scroll area 1 of window "Groups & Tags"
	end tell
end tell

set targetGroups to {}
repeat with i from 1 to count of selState
	if item i of selState is equal to true then
		set end of targetGroups to item i of selName
	end if
end repeat

tell application "DEVONthink Pro"
	set sourceRecord to (selection as list)
	repeat with i in sourceRecord
		repeat with j in targetGroups
			set targetRecord to record j of database 1
			replicate record i to targetRecord
		end repeat
	end repeat
end tell

I unfortunately cannot give any assistance, but I’ve bookmarked this thread as something to watch!

Definitely could see myself using this going forward. Hope some of the more knowledgable users are able to help you out!