When you log in to the PTC User site, Go to Resources, Library, expand the public files area, (pick "View all Topics"), pick Scripts. The top three items are what you want.
See the attached email for how to use the file I posted. That file was written by Dan Wolf, one of the guys I work with recompiled it after making a minor change.
[cid:image001.png@01CFE207.F2D9C440]
David Haigh