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