Can you script the "auto-group" function?

I have an applescript that pulls a bunch of documents and puts them into a devonthink group. I would like to then, using applescript, use the “auto group” function to sort the documents into subfolders.

Is there a way to do this – I don’t see anything in the dictionary and I’m having trouble doing a “System Events” runaround.

If there is no way way to do this, anyone have suggestions for alternatives that come close?

Sorry, but no - the auto-group function is not accessible via AppleScript.

What did you try with System Events and what issue(s) did you run into?

Not an expert at System Events scripting but I want to 1) select a group 2) select all items in the group and 3) choose “Auto Group” from the menu. 3 isn’t an issue. I’m not sure how to do 1 and 2.