Getting Scripting This is the page you start at to get scripting if you don't have it. Sure, if you have Windows98/NTSP4 or newer, you already have it on your CDROM or hard drive. But getting it from here means you get the latest version. It's worth the download if you have even a slim doubt. Getting the scripting host and VBScript/JScript engines is easy (they're bundled), but you'll have to crawl through the links to find the help files and the sample code collection. And of course, to encourage you to upgrade, Windows 95 is no longer supported in the most recent versions. You'll need to get version 5.5 if you have Win95. No guarantee that's even going to work since 95 isn't supported any longer!
Essentials of VB Scripting After you install it, it becomes a collection of web pages (IE required) that cover how to use version 3 scripting (the early version without all the cool features) in all three ways: Server ASP, Client Web Pages, and the Windows Scripting Host. This is about a 30-minute overview of how to do the basics. If you've never done scripting, this is a good starting place.
Learn to Script Microsoft's list of suggested resources for people wanting to learn scripting.
Vim FREE -- Syntax highlighting. Supports virtually all languages or any conceivable text formatting scheme. Extendable to additional keywords or languages. The UNIX origins are very apparent -- everything happens in a bland terminal window. Not all versions are stable under Windows.
Try another simple one: Again start up Notepad, but enter this
strMyName = InputBox ("Enter your name")
MsgBox strMyName & " is my master!"
Again, save it (any name with a .vbs extension) and double-click it. Easy.
From here, you just need to read the help files (After you FIND the help files on Microsoft's site!) on Visual Basic Scripting and the Windows Scripting Host to see what other things you can do. Also check out the sample code Microsoft provides! Search your C: drive for all "*.vbs" files if you're not sure where they are. By far the coolest thing about scripting is how it can control Excel, Word, or most any other ActiveX program. Once I saw the "chart.vbs" sample Microsoft provided, I was hooked!
First, when your script fails, the Windows Scripting Host will tell you the line number, column number, and a description of the error. The error it reports gives you a good starting point, but trying to count down to line 132, column 43 to find it in your code is unworkable. Because... The default script editor (if you right-click a VBS file and select "Edit") is Notepad. And Notepad has no line or column counters. So you can buy a nice script editor like I did. Or use a fancy word processor or the old DOS program EDIT.COM.
the handiest free item
has is the scripting
debugger. The debugger works three ways:
First, you can use it to open and edit your scripts. It's about as useful as Notepad in this respect. Pretty lame.
Second, when you have an error, the debugger opens up and highlights the line where the error occurred. Well, if you have the original scripting Host that shipped with Win98 or NTSP6 it acts that way. If you upgraded your scripting host to the most recent version, the debugger won't start on an error unless you launched your script with the "//d" option (like "wscript //d myscript.vbs" or "start myscript.vbs //d". It won't let you do anything about the error in this mode other than running a command in the "Command Window". Getting better...
Third, you can put the word "stop" in your script. When your script hits that "stop" line, it pauses and starts up the debugger. Again, that's only true on the original version of the scripting host. On the new version, you have to use the //d option to get it to recognize the "stop" word. In this mode, you can step through your code and use the full capabilities of the debugger.
Fourth, you can start your script with the //x option (if you have the new version of the scripting host). That way it starts the script in the debugger automatically without waiting for an error or a stop word.
So basically, unless you use "stop", "//d", or "//x", the debugger will do nothing more than frustrate you. I use the //x option so much I set up a right-click association for VBS files.
CAUTION: Don't install the scripting debugger if you have Microsoft Visual Studio (VS) or VS .NET on your system. You don't need it! VS has a built-in debugger that works just fine (actually better!) on scripts. Installing multiple debuggers could tear a hole in the universe. Or in your computer. However, I've found that having VS6 and VS.NET on the same computer is no problem. You just get asked which debugger you want to use.