How could I create a txt or rtf list of all groups and sub-groups names and item links?

an example would be

DevonThink Tips x-devonthink-item://943BA672-B0E5-4401-AE73-60B37A65D16E

thanks in advance for your time and help

One approach might be to simply select all desired (sub-)groups, use Edit > Copy Item Link and paste this into e.g. a plain/rich text document in TextEdit. Another possibility is to create a customized version of Scripts > Export > Listing…

I will try. thank you

Would it be asking too much to modify your script below from oct 2020 so that group and sub-group names are followed by their link ?

If I am asking too much of your time, no problem !

thank you

source

script

-- Create Group Listing
-- Created by Christian Grunenberg on Sun Jul 24 2005.
-- Copyright (c) 2005-2009. All rights reserved.
-- Modified 20130602 to capture only groups
-- Modified by @clane47 11_01_2013 to capture only groups to a rich text file
-- Modified by @korm 20131102 to put the listing on the clipboard for pasting elsewhere
-- Additional modification 20131102 to optionally set base group for the listing to the selected group
-- Improved error handling and much higher performance by Christian Grunenberg on Wed Oct 28 2020

tell application id "DNtp"
	try
		if not (exists current database) then error "No database is open."
		
		set listScope to button returned of (display dialog "Scope of Group Listing" buttons {"Whole Database", "Selected Group and SubGroups", "Cancel"} default button 1 cancel button 3 with title "Put a Group Listing on the Clipboard")
		
		show progress indicator "Creating Listing..." with cancel button
		
		if listScope is "Whole Database" then
			set the clipboard to my createListing(children of root of current database whose type is group, "")
		else if listScope is "Selected Group and SubGroups" then
			set the clipboard to my createListing(children of current group whose type is group, "")
		else
			error -128 -- Cancelled
		end if
		
		hide progress indicator
		
		display notification "Listing in clipboard!" with title "Create Listing"
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
	end try
end tell

on createListing(theseGroups, theTabs)
	local this_group, this_listing, this_name, nextTabs
	tell application id "DNtp"
		set this_listing to ""
		set nextTabs to theTabs & (ASCII character 9)
		repeat with this_group in theseGroups
			set this_name to (name of this_group as string)
			set this_listing to this_listing & theTabs & this_name & return
			step progress indicator this_name
			set this_listing to this_listing & my createListing(children of this_group whose type is group, nextTabs)
			if cancelled progress then error -128
		end repeat
	end tell
	return this_listing
end createListing
1 Like

It’s a pretty simpe modification.
Replace the on createListing handler with this…

on createListing(theseGroups, theTabs)
	local this_group, this_listing, this_name, nextTabs
	tell application id "DNtp"
		set this_listing to ""
		set nextTabs to theTabs & (ASCII character 9)
		repeat with this_group in theseGroups
			set this_name to (name of this_group as string)
			set this_link to (reference URL of this_group as string)
			set this_listing to this_listing & theTabs & (this_name & "	" & this_link) & return
			step progress indicator this_name
			set this_listing to this_listing & my createListing(children of this_group whose type is group, nextTabs)
			if cancelled progress then error -128
		end repeat
	end tell
	return this_listing
end createListing
1 Like

thanks very much !

You’re welcome.

I created a new version as per your instructions. Links are added which is perfect

My remaining problem is that the result is a huge list which is a dizzying mishmash of name + links of trash, tags, groups, subgroups and docs.

Would you have the patience to show me how to modify the script so that I end up with a listing of only Groups and SubGroups including names and Links. If possible, subgoups start with a tab under the group name.
I don’t want to include listing of tabs, documents and if possible no trash.

Thanks very much

-- Create Group Listing
-- Created by Christian Grunenberg on Sun Jul 24 2005.
-- Copyright (c) 2005-2009. All rights reserved.
-- Modified 20130602 to capture only groups
-- Modified by @clane47 11_01_2013 to capture only groups to a rich text file
-- Modified by @korm 20131102 to put the listing on the clipboard for pasting elsewhere
-- Additional modification 20131102 to optionally set base group for the listing to the selected group
-- Improved error handling and much higher performance by Christian Grunenberg on Wed Oct 28 2020

tell application id "DNtp"
	try
		if not (exists current database) then error "No database is open."
		
		set listScope to button returned of (display dialog "Scope of Group Listing" buttons {"Whole Database", "Selected Group and SubGroups", "Cancel"} default button 1 cancel button 3 with title "Put a Group Listing on the Clipboard")
		
		show progress indicator "Creating Listing..." with cancel button
		
		if listScope is "Whole Database" then
			set the clipboard to my createListing(children of root of current database whose type is group, "")
		else if listScope is "Selected Group and SubGroups" then
			set the clipboard to my createListing(children of current group whose type is group, "")
		else
			error -128 -- Cancelled
		end if
		
		hide progress indicator
		
		display notification "Listing in clipboard!" with title "Create Listing"
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
	end try
end tell

on createListing(theseGroups, theTabs)
	local this_group, this_listing, this_name, nextTabs
	tell application id "DNtp"
		set this_listing to ""
		set nextTabs to theTabs & (ASCII character 9)
		repeat with this_group in theseGroups
			set this_name to (name of this_group as string)
			set this_link to (reference URL of this_group as string)
			set this_listing to this_listing & theTabs & (this_name & "	" & this_link) & return
			step progress indicator this_name
			set this_listing to this_listing & my createListing(children of this_group whose type is group, nextTabs)
			if cancelled progress then error -128
		end repeat
	end tell
	return this_listing
end createListing