You mean “groups”, I guess. And yes, you can create them automatically with AppleScript or JavaScript.
But are you sure that 800+ groups in DT are what you want?
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
property theWorks : {"Folder 1", "Folder 2", "Folder 3", "etc"}
tell application id "DNtp"
repeat with theWork in theWorks
set theWork to (localized string theWork)
create record with {type:group, name:theWork} in current group
end repeat
end tell
Thank you. Yeah I guess I can script them. I wish there was a scripting guide for DevonThink. I haven’t the slightest idea how to begin with JavaScript scripting.
You can do it in a matter of seconds using RegEx. If you don’t have any text editor, download one and play around with it (e.g. BBEdit, Sublime Text, Visual Studio Code). It should be a simple matter of replacing all ^(.+)\n with "\1",
tags? Groups are kind of intrusive (for lack of a better wording). Navigating 800+ groups seems like a self-inflicted nightmare to me. As would be 800+ folders in the Finder.
But it’s your decision, of course.
In this case create location might be better than create record with as you could create groups and sub groups in one go. Make sure that slashes in your sub group names are escaped! Select the record containing the group names, run the script and you’re done.
-- Create groups based on selected text record
property theSubGroup_Locations : "1
1/1.1
1/1.1/1.1.1
2
2/2.1
This group name contains a \\/ and \"quotes\"
"
tell application id "DNtp"
try
set theSelection to selection of viewer window 1
if theSelection = {} or ((count theSelection) > 1) then error "Select one record."
set theRecord to item 1 of theSelection
set theText to plain text of theRecord
if theText = "" then error "Select a record with text."
set theGroupNames to paragraphs of theText
set theGroup to display group selector "Create groups in:"
set theGroup_Location to (location of theGroup & name of theGroup) as string
set theSubGroup_Locations to paragraphs of theSubGroup_Locations
repeat with thisGroupName in theGroupNames
if thisGroupName contains "/" then set thisGroupName to my replace_String(thisGroupName, "/", "\\/ ")
set thisGroup_Location to (theGroup_Location & "/" & thisGroupName) as string
set thisGroup to create location thisGroup_Location
repeat with thisSubGroup_Location in theSubGroup_Locations
create location (thisGroup_Location & "/" & thisSubGroup_Location) as string
end repeat
end repeat
display notification "Groups created"
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
on replace_String(theText, oldString, newString)
local ASTID, theText, oldString, newString, lst
set ASTID to AppleScript's text item delimiters
try
considering case
set AppleScript's text item delimiters to oldString
set lst to every text item of theText
set AppleScript's text item delimiters to newString
set theText to lst as string
end considering
set AppleScript's text item delimiters to ASTID
return theText
on error eMsg number eNum
set AppleScript's text item delimiters to ASTID
error "Can't replaceString: " & eMsg number eNum
end try
end replace_String