In case you tried to run the script you’ve found that it doesn’t work as expected in DEVONthink 3.6.
There’s a problem with creating Smart Groups via AppleScript, see Are Smart Groups in DEVONthink 3.6 broken?.
Updated the script with a workaround.