Saturday, August 25, 2007

Microsoft Scripting Engine 5.7 is Out

For years, no changes were made to the Microsoft Scripting Engine. Version 5.6 was released in October 2001, together with IE 6.

With the introduction of IE 7 in November 2006, MS included a 5.7 scripting engine. But IE 7 is still not supported by many sites and web applications and is disliked by most IT managers (plus, after trying it you'll rush to install Firefox since it's clearly superior in many ways).

Yesterday, Microsoft finally released a standalone version of the 5.7 scripting engine. I still don't know what are the new features or fixes in it (still nothing on MSDN or the other tech blogs), but since it's the newest version in 6 years, I of course downloaded it. And you can too:

The engine controls 3 main scripting technologies:
  1. JScript - the MS JavaScript flavor. Hated by many over the internet, but was the first to institute some constructs that allowed for AJAX to become a household name (and as a consequence, Web 2.0).
  2. VBScript - the simple brother of JScript. It does the same things, but speaks a simpler language (a crippled Visual Basic). Has been mostly in use on the server side through ASP.
  3. Windows Scripting Host - an underlying layer in Windows that allows accessing, integrating and executing scripts at the system level.
    Look at my CodeProject article to get a sample of such a script, written in JScript.

You can start using WSH right away. In fact, it's much better than running batch files, since scripts can access Windows API, COM components, Windows services etc. And most importantly, can be debugged. To start, just write a script in a text file, rename the extension from .txt to .js/.vbs (depending on the language) and double-click the file.

Example: type WScript.echo("Hello World!"); into test.js and double-click it.

Worth mentioning:
  1. Your antivirus program may block such scripts, in which case, open a command window and type cscript my_script_filename to execute your script (or set you antivirus to allow script executions).
  2. The installer leaves a restore point, so if anything goes wrong, or if you experience any issues with browsing, just restore your system to where it was.
  3. If you'd like to start writing WSH scripts, but don't like the idea of starting from scratch, use the Scriptomatic, a wizard-like tool that will create most of the script for you.
  4. There's a JScript.Net flavor, that uses the .Net Framework and services from within the script. While it's nice, I haven't seen widespread use of it and it requires the right framework installed to function.

No comments: