I noticed that if I have a .js file in windows explorer (not Internet Explorer, I’m meaning the folder explorer…) I can actually click on it and it will execute, giving error messages, like say “window object is undefined”. Is there more information about the environment where the .js script are run into and the objects available?
Share
Windows Script Host provides a reasonably rich environment allowing one to do a variety of interesting things – just yesterday I used it to create a tool that analyses a directory full of XML files which reference various resources such as images and other XML files, and produce an XML manifest in a predefined schema.
It’s worth taking the time to get used to creating
.wsffiles (which use an XML-based syntax), rather than just running.js(JScript) or.vbs(VBScript) files –.wsffiles offer much finer control over modularity and allow for better in-file documentation and usage explanations, and also allow scripts written in several different languages to be combined, which is handy if you find a VBScript that does 40% of what you need and don’t want the hassle of converting it to use with the 60% you’re writing in JScript.