This modified script copies the structure for the group you’ve selected in the sidebar or for the whole database.
Remove the tabs afterwards (in e.g. BBEdit) to get a plain names listing.
-- Copy group names (structure)
-- Create 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
tell application id "DNtp"
try
if not (exists current database) then error "No database is open."
set theDatabase to the current database
show progress indicator "Creating Listing..."
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")
if listScope is "Whole Database" then
set the clipboard to my createListing(children of root of theDatabase, "")
else if listScope is "Selected Group and SubGroups" then
set rootGroup to the current group
set the clipboard to my createListing(children of rootGroup, "")
else
return
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 Pro" message error_message as warning
end try
end tell
on createListing(theseRecords, theTabs)
local this_record, this_type, this_listing, this_name
tell application id "DNtp"
set this_listing to ""
repeat with this_record in theseRecords
set this_name to (name of this_record as string)
set this_type to (type of this_record) as string
if this_type is "group" or this_type is "«constant DtypDTgr»" then
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_record, theTabs & (ASCII character 9))
end if
end repeat
end tell
return this_listing
end createListing