Sunday, February 06, 2005

Scriptomatic 2.0

For those doing automation - and who doesn't? - Scriptomatic from Microsoft just got a major overhaul: Support for multiple scripting langauges and output formats. Use it to jumpstart your scripts. It is a very useful product - although there are still improvements wanted - at least for the VBScript version. I think a global On error resume next is considered bad programming. Likewise a missing Option Explicit is bad. I am aware that Scriptomatic is intended to get you going and it does that very well, but learning scripters bad habits is not a good thing. Normally, on error resume next / goto 0 should only surround statements throwing an error you want to catch. Without Option Explicit, you can risk all sorts of side effects in your code if it grows beyound a few lines. An example:
dim lngCounter
lngCounter=1
wscript.echo lngCounter
IncreaseCounter
wscript.echo lngCounter

sub IncreaseCounter
lngCounter=lngCounte+1
end sub

This will echo 1 and 1 and and not 1 and 2 as expected. This is caused by a spelling mistake in the statement in IncreaseCounter. Option Explicit would have caught this error.

No comments: