New group from list of links?

What’s the easiest way to make a group from a list of links?

For example, if I’m writing a text and adding links to other documents in my database, the “Links” section lists all related documents. Can I make a group from that list? It’s easy enough to highlight all the items listed as links in the Inspector, but I can’t figure out how to make a group containing those linked items. If I drag them, rather than copying the items, DEVONthink creates new Internet location items. If I right-click the items in the Links section, I have the option to open them in new tabs. But AFAIK there’s no built-in command/script to create a new group containing all the open tabs.

Even a simple script/command to replicate the item shown in the preview pane into the current group would make this relatively smooth, albeit a bit tedious. Is there really no stock command for executing such a simple procedure??

Here’s another scenario: if I run the “Summarize mentions” command, how do I easily make a group with the texts linked in that document?

Is there really no stock command for execuring such a simple procedure??

No has ever requested such behavior before and the Mentions inspector is brand new in 3.8. No one has ever requested it from the Links inspector either.

And please clarify the intent here. Are you wanting to move items into a group or replicate them?

Replicate would is better suited for my purposes. Or an easy way to make a smart group based on the links referenced in an item.

Are the linked files always only in the same database? You cannot replicate across documents.

Yes. Same database.

Here is a document with two WikiLinks and an item link.
The WikiLinks have been replicated into a group bearing the document’s name & “- Linked Files”.

Note the item link isn’t in the same database and shows an error notification.

This is logged in DEVONthink’s Window > Log

Does that appear sufficient for your purposes?

1 Like

How did you replicate them into the group? When I try simply dragging the item from the Links inspector into the group, it creates an internet location even when the item that the item link points to is in the same database.

Via a script i wrote.
Do the results appear as expected?

This is the script I wrote…

tell application id "DNtp"
	repeat with thisRecord in (selected records)
		set outgoingWiki to outgoing Wiki references of thisRecord
		set outgoingRefs to outgoing references of thisRecord
		if (outgoingRefs ≠ {}) or (outgoingWiki ≠ {}) then
			set currentDB to (database of thisRecord)
			set recName to (name of thisRecord)
			set allLinks to items of outgoingWiki & outgoingRefs
			set dest to create location (location of thisRecord & (recName & " - Linked Files")) in (database of thisRecord)
			repeat with theLinkedDocument in allLinks
				if (database of theLinkedDocument) = currentDB then
					set replicantRecord to replicate record theLinkedDocument to dest
				else
					set errLog to log message info "Cross database replication is not allowed" record theLinkedDocument
				end if
			end repeat
			if errLog then display notification "Open Window > Log for more information." with title "DEVONthink Link Replicator" subtitle "Error gathering links…"
		end if
	end repeat
end tell