This weekend I'll need to do some recreational therapy programming in SML, Haskel or Lisp.
Well.. I have this problem at work that I need to solve. It involves modifying a lot of configurations on several windows workstations. Yuck.
Not only that; I had to restart services, call some some services, alter the configuration back again and restart services. Again.
Now I'm really not a windows guy. Working with workstations is really not my cup of tea either. And our setup is pretty old and locked down. So if I'm going to script this I don't have much choice - I'll have to use
vbscript; because that's what is available (and still usable to some extent).
I do not care much for vbscript. I've tinkered with it to help friends with their problems, but I've never really sat down to write something that I'd care to use before.
"Oh well", I thought,
"When you get your hands dirty and actually start producing something you usually end up with a better understanding of the concepts of the language and you won't mind as much." After all, I don't loathe
php much anymore. And I almost like
perl sometimes. (g)
Awk is quite practical.
I was so wrong! So Naive!
The error handling... if you could call it that is just horrible. You can trigger an error yourself, that's not so troublesome. The problem is that if you do this from a function returning a value you are screwed. The assignment after the function call will override your error. Very useful. Not.
Solution: Do not return values from a function. Use Call by Reference - which let's me segway smothely to the next rotten egg.
The calling conventions used, for historical reasons, is something I'm going to scare children with when I grow old. You do not want to know. Trust me. If you don't,
read this. I strongly advice you NOT to do so. You'll need hard liquor. Lots of it. And a shower. And then therapy.
I could go on for ever, but I need some sleep and my script needs to test itself tomorrow. Everything seems to be working and the tests seem to be in good shape.
I sincerely hope that this is the last thing I ever write in vbscript or vb.