Add reference to DT item when assembling comments

I use comments for DT items all the time. While I like the ability to select all my document in DT and select Comments->Assemble to see all my comments in a single place, the comments give no reference to which document they came from in the text of the comment document. Is this something that could be added? My scenario is this:
I use DT to review documents. If the document is of interest, I make comments. Each week, I need to produce a report of the documents I commented on, along with the reference to the original document. It would be nice if DT would add the reference to the original document the comment came from in assembled comment document.

So an example comment document would look like this:

reference to document 1 (Or title of it)
followed by the comment I put into that document

reference to document 2 (Or title of it)
followed by the comment I put into that document

As of now, it justs shows the comments in the comment document, but I have to add where they came from, unless I’m missing something…which is likely.

Bob

Just try this script:


-- Assemble Comments
-- Created by Christian Grunenberg on Tue Dec 07 2004.
-- Copyright (c) 2004-2009. All rights reserved.

tell application id "com.devon-technologies.thinkpro2"
	try
		set these_items to the selection
		if these_items is {} then error "Please select some contents."
		set theAssemble to ""
		set theCnt to 0
		repeat with this_item in these_items
			set this_comment to the comment of this_item
			if length of this_comment > 0 then
				set this_name to name of this_item
				set theAssemble to theAssemble & this_name & ":" & return & this_comment & return & return
				set theCnt to theCnt + 1
			end if
		end repeat
		
		if (theCnt > 0) then
			create record with {name:(theCnt as string) & " comments", type:txt, plain text:theAssemble} in current group
		end if
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

This is great. Is there also a way to grab the URL of the item in addition to the name? Does the name of all the available elements for each DT item exist somewhere that I can reference from a script?

So from the script:
set this_name to name of this_item

I’m assuming this_name gets assigned the name of the item in DT from my selection. Sorry, never used this before. So if I know the name of the URL element, I can add that to the output too.

It’s possible but I’ll leave this up to the reader :slight_smile:

Just drag & drop DEVONthink Pro onto Apple’s Script editor and you’ll get a description of the complete AppleScript suite.

Got it -
if length of this_comment > 0 then
set this_name to name of this_item
set this_name to URL of this_item