The scripting documentation has all the info you need to use the Scripting API, and MSDN will help you with JScript in general
In fact, what you want to do sounds fairly simple, and after a bit of searching and reading, you should be able to knock up a working script in a couple of hours, easy