Do you have the character mesh selected when you run the script? The "$" sign means to operate on the selected object, so if nothing is selected it returns "undefined".
In Max 2009 (or 2010?) and above, you can select multiple objects and apply the Unwrap UVW modifer to the entire selection at once and edit the entire selection together.
FWIW, there's an icon on the right side of the Material Editor, four colored balls with a black pointer, "Select By Material." Selects all meshes that use the currently-selected material.
You can try a startup script ( --SET SELECTION MODE actionMan.executeAction 0 "59235" --SET SELECTION CENTER setCoordCenter #selection --TURN ON SNAP snapMode.active = true)
Not sure why you'd need this. But you can select an element first (for continuity), hide unselected, then use select by SG, select your smoothing group, and voila.