list groups but not subgroups

I apologize for asking a trivial thing. I have a group “Projects” where a bunch of subgroups reside. Some of these subgroups have their subgroups. What I need is a list (best an RTF file, but smart group would also do) of the subgroups of the group “Projects”, but NOT their subgroups. I’ve tried excluding from tagging, to no avail, and my AppleScript skills are next to a monkey.

Thanks.

Gvido

Here’s a small example script to create an RTF document with a list of subgroups in the current group.


tell application id "DNtp"
	set theGroup to current group
	set theChildren to children of theGroup
	set theNames to ""
	repeat with theChild in theChildren
		if type of theChild is group then set theNames to theNames & name of theChild & return
	end repeat
	create record with {name:(name of theGroup as string), type:rtf, content:theNames}
end tell

Just have to thank you for every time you post these scripts Christian. I learn a lot from them every time even if I am not going to use the script directly.

I file them away in a DT database specially for dt scripts with tags indicating the useful parts of the content. So this script has tags for ‘group’, ‘children’ & ‘create record’.

This makes it easy to find and example later on when I need to know how to address children.

I see that the dictionary defintions in the latest version of pages and numbers sometimes have a one line example of how to use the verb, noun etc. It might be something to consider adding next time the help is revised.

Frederiko

I totally agree with Frederico, but had not thought of saving them in DevonThink…I will now :slight_smile:

You can add your own folders as subfolders of


~/Library/Application Support/DEVONthink Pro 2/Scripts

Put your favorite forum scripts and anything else you find or create in your private subfolder(s). They will then appear in the Scripts menu in DEVONthink. No need to store scripts in the database. Last I looked I had about 400 scripts that I made, modified, or harvested from others in my own folders. DEVONthink updates never touch your personal folders in Scripts or in Templates.

For the latest in command syntax, open the DEVONthink dictionary in AppleScript editor and Print it to PDF. Makes a handy reference.

My pleasure :smiley: