Scripts > Export > Listing… will produce a text file that lists the contents of a whole database. This script will list the contents of only selected groups. (Non-contiguous selections made using command-click are allowed.)
Optionally, change the onlyGroup property at the beginning of the script from FALSE to TRUE to cause the script to list only group names but not the names of child documents.
-- Create Listing for a selection and its children
-- 20120831 korm
-- based on Create Listing script by:
-- Created by Christian Grunenberg on Sun Jul 24 2005.
-- Copyright (c) 2005-2009. All rights reserved.
-- change this property to FALSE (no quotes) if a listing of documents within groups is also desired
property onlyGroup : false
tell application id "com.devon-technologies.thinkpro2"
try
if not (exists current database) then error "No database is open."
set theDatabase to the current database
set theFile to choose file name default name ((name of theDatabase) as string) & ".txt"
show progress indicator "Creating Listing..."
set theSelection to selection
if theSelection is {} then error "Please select a group"
set theListing to my createListing(theSelection, "")
set thePath to POSIX path of theFile
if thePath does not end with ".txt" then set thePath to thePath & ".txt"
set writeFile to open for access (thePath as POSIX file) with write permission
set eof writeFile to 0
considering numeric strings
if AppleScript's version as string < "2.0" then
write (ASCII character 254) to writeFile
write (ASCII character 255) to writeFile
write (theListing as Unicode text) to writeFile
else
-- Bug of Leopard, encoding is undefined
write theListing to writeFile as Unicode text
end if
end considering
close access writeFile
hide progress indicator
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 "com.devon-technologies.thinkpro2"
set this_listing to ""
repeat with this_record in theseRecords
if onlyGroup then
if kind of this_record is "Group" then
set this_name to (name of this_record as string)
set this_listing to this_listing & theTabs & this_name & return
set this_type to type of this_record
if this_type is group then
step progress indicator this_name
set this_listing to this_listing & my createListing(children of this_record, theTabs & (ASCII character 9))
end if
end if
else
set this_name to (name of this_record as string)
set this_listing to this_listing & theTabs & this_name & return
set this_type to type of this_record
if this_type is group then
step progress indicator this_name
set this_listing to this_listing & my createListing(children of this_record, theTabs & (ASCII character 9))
end if
end if
end repeat
end tell
return this_listing
end createListing