A quick text clipping script

Here’s a script to clip text from DT Pro to DT Pro, based on the included “Add Selection” from Safari script. As written, it clips in plain text, but can easily be modified to clip in RTF.

It differs from DT’s Capture Note function, in that a) you can attach a hotkey to it, b) it clips plain text, and c) it can be directed to any destination you choose (eg “CLIPPINGS”), rather than just the default group. Or you can use a pop-up menu to choose the group (“set inGroup to display group selector “Destination” buttons {“Cancel”, “OK”}”). The ability to specify different target groups also differentiates it from the Take Note service. Finally, I think it’s a quicker, more elegant solution than the included “Copy Selection” script, and includes the title and url of the source page.

property theGroup : "/CLIPPINGS"

tell application "DEVONthink Pro"
	set this_url to the URL of window 1
	set this_title to the name of window 1
	set this_text to the selected text of window 1
	set inGroup to create location theGroup
	create record with {name:this_title, type:txt, URL:this_url, plain text:(this_url & return & this_title & return & return & this_text)} in inGroup
end tell