Works very similar to the original cometRename script , just one difference that cometRename can do while this script couldn't :
-I left click & drag selected several shading groups in the "Shading Group" tab in Hypershade, your script only `Rename & Number` one of the groups (possibly the latest one selected by the drag rectangle), but cometRename could rename & number all the groups.
anyways all other functions work ok as it should.