How to have sub-groups inherit their group exclusions from classification + sorting column items and options?

Hi

As my databases have grown and as I get more and more nested subsubsubsubsub groups I struggle on the productivity front.
What is the way to have a parent group

  1. that is excluded from classification to drive exclusion also to its sub and sub sub sub group. ?
  2. that has the correct layout that is columns (name, modification dates etc…) which are carefully picked + sorted at the folder level (or even at the root database level) to drive these settings also to its sub and sub sub sub group. ?

On these 2 I lose too much time now setting these down the subsubsubsubsub and manually there might be a less dumb way for the dummies…

Thank you very much

  1. This is not possible without scripting, either a standalone script or in a smart rule / batch process.

Here is a teaching edition snippet that does what you’re referring to…

tell application id "DNtp"
	
	-- Get the selection
	set sel to selection
	
	-- If there is something selected, proceed.
	if sel ≠ {} then
		
		set sel to item 1 of sel
		
		-- Is it a group?
		if (type of sel) = group then
			
			-- Get the current exclusion of the selected group
			set parentExclusion to (exclude from classification of sel)
			
			-- Call a handler to process any subgroups
			my processGroups(sel, parentExclusion)
		end if
		
		-- If nothing is selected, disaply an alert and exit.
	else
		display alert "Nothing is selected. Please select a group and run this script again."
	end if
end tell

on processGroups(theGroup, parentExclusion)
	tell application id "DNtp"
		
		-- Loop through the children of the selected group, specifically targeting the children in the selected group who are subgroups
		repeat with theChild in (children of theGroup whose (type = group))
			
			-- Set the same exclusion state to the parent's exclusion state
			set (exclude from classification of theChild) to parentExclusion
			
			-- If this subgroup contains children who are groups, process them by recursively looping back to this same handler
			if (count (children of theChild whose (type = group))) > 0 then
				my processGroups(theChild, parentExclusion)
			end if
			
		end repeat
	end tell
end processGroups
  1. If you set columns in a database, those should propagate to its groups (though @cgrunenberg would have to comment on the difference in the horizontal positions of the columns being different when you open a group in a new window).
1 Like

Thank you very much for your time
I regret I have no experience in scripting not even the slightest idea where to put that snippet…
Would you have for your devonthink solution a network of experts who can help for a fee to implement this ?
Thank you very much

  1. Download and unzip the attachment here.
  2. Select the Script menu > Open Scripts Folder.
  3. Open the Menu folder.
  4. Drop the .scpt file into the Menu folder (or a subfolder in this folder). It is now available in the Script menu. You can select a group and run the script and it will apply the current exclusion to its subgroups.

DT Group Recursion_TE.scpt.zip (4.4 KB)

Thank you so much !
I ran the script on a large database with many sub sub etc…groups and it would have been humanly impossible to run this manually…So provided you wait some time for the script to go folder by folder to run its magic it does work like a breeze…
Except I noticed only folders inherit the exclusion status, not any files will inherit that exclusion status from this script
But is it safe to assume that the way exclusion from classification work in DT (which is something I did not know) is like “files in a folder that is excluded from classification and of which they directly depend will always be excluded from classification” ?
I am sorry but just want to make sure…
Thank you !

Files don’t have an exclusion from classification. You can only classify into groups so an exclusion from classification on a file doesn’t make sense.

1 Like

Of course that is logical.
I guess what got me puzzled is the presence at file level of that exclusion tick box (which doesn’make any sense :blush: ) so just wanted to make sure…
Thank you very much again your help much appreciated here this has made my day Thank you

You’re very welcome.

the presence at file level of that exclusion tick box

@cgrunenberg: Perhaps Exclude from Classification should be disabled when a file is selected?

Files can actually be excluded from classification, e.g. if you get poor classification results due to one specific file in a group.

2 Likes

Interesting. Still learning, all these years later. :slight_smile:

1 Like

That is actually very very useful to have in mind and how this works in reality…
Thank you…
I have used several strategies for grouping which included the assumption that I better slice my groups in a way where no outlier-files would pollute the inside-cohesiveness of the group.
So for the outlier-files I would endup having to create groups (excluded from classification) that are buckets containing only outliers…which was I guess making sense for the purpose of avoiding classification to dis-function but terrible on many other aspects including the strange existence of these groups dedicated to be filled with totally unrelated files, real black holes filled with all sorts of missfits…
I see now that I do not need to bother doing that, just exclude from classification the files which are outliers-but-still-would-need-to-be-in-that-specific-group.
I guess I can get rid of many horrible very ugly black hole groups now…
Thank you very much for your support

Thank you very much for sharing this script! Just to make it clear to any other lay users who are not familiar with AppleScript (such as myself), you have to manually mark the group whose subgroups you want to exclude as excluded from classification. I thought the script would do it for you. It would be useful if the script had an error message to the effect that “selected group must be set to excluded from classification for script to work.” I assumed it just didn’t work, but after manually going through about 200 groups this morning and excluding them, I decided to give it another try. It worked!

You’re welcome.

The script is meant to act as a toggle, hence the need to set the exclusion on the parent folder. This allows you to toggle it off as easily as toggle it on.