Because Notepad isn??™t specifically designed to understand
VBScript, it can??™t offer any assistance with syntax (grammar) or errors while
you??™re editing. Therefore, you must wait until you run the script to see
whether there are any problems. If WSH encounters an error, it will display
a message similar to that shown in Figure 9-2.
Surprisingly, this sparse message box actually provides enough information
to resolve most problems. Naturally, the first field, Script, shows the script
filename in which the error occurred. This is especially useful if the script was
run from a scheduled task or from your Startup folder, and you might otherwise
not know which script caused the error.
The Line Number and Column fields show exactly where in the script the
error occurred, and include blank lines and remarks. If you??™re using Notepad,
select Status Bar from the View menu to display the line number at
which the insertion point (text cursor) is resting. Or, select Go To from Notepad??™s
Edit menu to quickly jump to any line. Better yet, switch to a better text
Object References | 541
Scripting and
Automation
editor (discussed later in this chapter) that has more debugging tools, such
as numbered lines.
The Category field describes??”more than anything else??”what it was doing
when it encountered the error. A compilation error occurs when WSH is first
reading the file and making sure all of the commands are correctly entered;
you??™ll see this if you forgot a parenthesis or quotation mark, misspelled a
command, or left out some other important keyword.
Pages:
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753