The script can be anywhere on your hard drive, and should be somewhere other than the folder actions scripts folder so that it is not applied to a Finder folder inadvertently. To attach it to an indexed group in DEVONthink, select the group, bring up the info panel (command-shift-i), click on ‘Select’ to the right of the script field, and navigate to where the applescript is saved to the hard drive.