Replicating by default

Hi,

The number of times per day I want to replicate something is at least one order of magnitude greater than the number of times I want to move something. In fact, most days I move nothing at all, while hardly a day goes by when I don’t replicate 10-20 records (perhaps to remove some replicants later).

So here’s the question. Can anybody suggest some way to replicate something by dragging without having to press extra keys? Scripts with keyboard shortcuts etc are nice but often I actually want to drag (because I have arranged my windows on screen in a particular way etc).

Thanks.

1 Like

No suggestion, but you’re not the first (and unlikely to be the last :slight_smile:) that’s wanted an option for replication to be the dragging default, e.g.: here.

Ah, I thought I remembered that it had been mentioned before but wasn’t sure. Well, nice to know I’m not alone :slight_smile:

Naming it “implied replication” has made it easy to search for related threads where I’ve used that term. :slight_smile:

Another recent remark I made about replication:

… wonder how upcoming replicant-based tags and UI related changes might influence replicant management in general and possibly “solve” some of the existing issues as a side effect.

Though until there’s a more significant tag-supporting release I’m not giving that much thought.

Here’s something to really screw up your data.

The script takes a single source selection in your database, and single or multiple selections in the “Groups” window (ie “Tools”->“Show Groups”) and replicates the source to the target(s):

set theSource to ""
set theGroups to {}
set indexList to {}

tell application "System Events"
	tell process "DEVONthink Pro Office"
		set attribList to attributes of every row of outline 1 of scroll area 1 of window "Groups"
	end tell
	repeat with i from 1 to count of attribList
		if (value of item 11 of item i of attribList) is equal to true then
			set end of indexList to i
		end if
	end repeat
	tell process "DEVONthink Pro Office"
		repeat with i in indexList
			set end of theGroups to value of text field 1 of row i of outline 1 of scroll area 1 of window "Groups"
		end repeat
	end tell
end tell

tell application "DEVONthink Pro"
	set tmp to selection -- not sure why I have to use tmp here ;-)
	set sourceRecord to item 1 of tmp
	repeat with i in theGroups
		set targetRecord to record i of database 1
		set theResult to replicate record sourceRecord to targetRecord
	end repeat
end tell

CAVEATS: OF WHICH THERE ARE PLENTY. THIS IS ONLY ABOUT AN HOUR WORTH OF HACKING ON MY PART. I DON"T REALLY REMEMBER THE FINE POINTS OF APPLESCRIPT. THERE IS NO ERROR CHECKING. IF YOU SCREW UP YOUR DATA, BLAME YOURSELF, NOT ME.

Anyway, it does what I stated in the opening paragraph, maybe some of the UI scripting might be of use/interest to those who want to “tag” now, and someone might build a more elaborate/useful script out of the code. Have fun!

Best, Charles

OK, here’s a new version that should be a little faster getting its data from the “Groups” window:

set targetGroups to {}

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"
		set selName to value of text field 1 of rows of outline 1 of scroll area 1 of window "Groups"
	end tell
end tell

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 tmp to selection -- not sure why I have to use tmp here ;-)
	set sourceRecord to item 1 of tmp
	repeat with i in targetGroups
		set targetRecord to record i of database 1
		replicate record sourceRecord to targetRecord
	end repeat
end tell

Best, Charles

OK… Sorry for the many posts. The assignment of “selection” to “tmp” was bugging me, and I had to fix it.

As a bonus for your reading misery, this new version will take MULTIPLE SOURCES and MULTIPLE TARGETs and simply replicate each source into each target. Useful, but also an easy way to screw up your database with a lot of replicants.

Again, no error checking or defensive programming, so your use is your risk!

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


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"
		set selName to value of text field 1 of rows of outline 1 of scroll area 1 of window "Groups"
	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

Enjoy! Charles

That’s more sophisticated than the simple script I use to replicate records using the keyboard. I’ll switch to using this script instead. Thanks.

Still, I sometimes do drag things around, and it would be nice if I could somehow make it so that records get replicated rather than moved.

Your welcome. I’d be interested to hear about its performance when the Groups window has lots of rows to traverse. (I only tested it on a scratch database with about 20 groups.)

I’ve kept thinking about it, but haven’t come up with anything very elegant and free. I wonder why you don’t “Command-L” and drag, though?

Enjoy! Charles

I opened all my groups and it’s still instantaneous (they’re not that many though, maybe 30-40)

That’s better than control-shifting, but sometimes I just absent-mindedly drag things and then of course can’t find them. It’s bad enough that my files have titles like PhysRevD_77_025026.pdf or sgrg.pdf without the added excitement of them being in random groups (*).

Can you think of anything non-free? This annoys me enough that I wouldn’t mind paying.

(*) better names aren’t the answer: sgrg is completely obvious to me right now and for the last couple of months (“sine gordon renormalization”). in 6 months, the appropriate title may well be “projection to field-independent subspace”, because it’ll be that aspect of the paper that will interest me. so I just call them something short and remember what they actually contain by their location; hence the need for replication…

Well, you could use a custom mouse driver like Steermouse or USBOverdrive to customize your mouse action. At minimum, you could assign Command-L to a spare mouse button (and only for DT). You might even be able to save your selection’s initial location, and replicate it back after the move with an Applescript.

Also, if you use something like BIbdesk for citation management, you could also Applescript the replication of the tag structure there to DT, I’d guess.

Anyway, thinking out loud…

C

Aha, I was not even aware of this type of program (although I use keyboard maestro extensively). That sounds like it’ll do the trick, thanks!

I don’t use any citation manager unfortunately (I’ve probably expended 100 times more effort finding and inserting the citations into my papers by hand than I would collecting them in any manager, but…).