Errata

VBScript in a Nutshell

Errata for VBScript in a Nutshell

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 16
The 6th line in the last paragraph

The 6th line in the last paragraph now reads:
...multiplies by 27.3...

It should read:

...multiplies by 25.4...

Anonymous   
Printed Page 17
Example 2-2

This example does not work. The following is correct:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub cmdButton1_OnClick
Dim strInches
strInches = txtText1.Value
Alert CStr(sngMetric(strInches)) & " mm"
End Sub

Sub cmdButton2_OnClick()
Dim strInches
strInches = txtText1.Value
Alert CStr(sngMetric(strInches)/1000) & " m"
End Sub

Function sngMetric(strInches)
Dim sngInches
sngInches = CSng(strInches)
sngMetric = sngInches * 25.4
End Function
-->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="white">
Input Inches: <INPUT TYPE="text" NAME="txtText1">
<INPUT TYPE="button" NAME="cmdButton1" VALUE="Show Millimeters">
<INPUT TYPE="button" NAME="cmdButton2" VALUE="Show Meters">
</BODY>
</HTML>

Anonymous   
Printed Page 37

The variable declaration for the Null subtype now reads
dim myVarOne, myVarTwo, myVar Three

It should read:

dim myVarOne, myVarTwo, myVarThree

Anonymous   
Printed Page 48
2nd paragraph

May 2000 Printing
"For example, the following code from Global.asa amakes the . . ."

should read

"For example, the following code from Global.asa makes the . . ."

Anonymous   
Printed Page 49
3rd paragraph-end of code snippet

The right pointing arrow should be an HTML end-of-comment (-->)

Anonymous   
Printed Page 57
Sidebar at top of page

The statement that UDTs are missing might be accompanied by a mention of the
Dictionary object described on page 220. I think this could be used as a
UDT substitute.

Anonymous   
Printed Page 58
Next to last line of code in example on page

- - May 2000 Printing - -
Reads:
For iCtr = COUNTRY TO HAZARDS

Should read:
For iCtr = COUNTRY to HAZARDS

to be consistant with capitialization convention for constants

Anonymous   
Printed Page 74
First paragraph under "Launching the Script Debugger" subheading

This paragraph states that, "The Script Debugger is not a standalone application in
the sense that you can launch it on its own."

Anonymous   
Printed Page 83
First paragraph of the description of the Number property

The text states that, "The Number property is an integer value that contains an error
code value between 0 and 65535..." This is incorrect; in fact (as is stated
elsewhere in the book), this property may hold any 32-bit (or Long) value. It may be
that VBScript itself will never set an error code larger than 65535, but a COM
component may very well do so.

Anonymous   
Printed Page 92
2nd sentence of 1st paragraph under the RUNAT="Server" block

Printed:
or the <BODY>...<BODY> tags of an ASP document.

Should read:
or the <BODY>...</BODY> tags of an ASP document.

Anonymous   
Printed Page 96
3rd paragraph under the Response object header

The print version I have is listed as [9/00].

Under the Response object header is a list of Members of the Response
Object. The 3rd one listed is "BinaryWriteMethod." The description
states, "Writes information directly to the response body without any
character converstion."

"converstion" be changed to "conversion".

Anonymous   
Printed Page 118
In the last code sample, the 1st line of code currently reads

blnHasKeys = Response.Cookies("Colors").HasKeys

It should read:

blnHasKeys = Request.Cookies("Colors").HasKeys

Anonymous   
Printed Page 136
First paragraph of description of CreateObject

The statement, "...strPrefix is an optional string that instructs WSH to trap the
object's events (if it has any) and to fire event handlers whose names begin with
strPrefix followed by an underscore, followed by the event name." is incorrect. In
fact, no underscore is used; the strPrefix and the event name must be directly
concatenated.

Anonymous   
Printed Page 137
Description of GetObject method

I recently reported an erratum in the description of the CreateObject method on page
136. This concerns the incorrect statement that an underscore must be used to join
the strPrefix with the event name. I now realize that this same error applies here
to the description of GetObject.

Anonymous   
Printed Page 138
Table 7-5 headings

Type and Name headings (or columns) are reversed

Anonymous   
Printed Page 138
Table 7-5 Item's Description is incorrect

The decription indicates that you can use an integer index to access one of the
environment variable name/value pairs. This is not correct, you can only access
a value via the Item property using the varible's name, for example "PATH".
[This also true for default access].

In order to iterate through the list of name/value pairs you need to "enumerate"
the object created with the:

Set wsh = WScript.CreateObject("WScript.Shell")

command. This is [of course] done as follows in vbScript:

for sPair in wsh
'do something with this name/value pair
next

It would be valuable to correct the above and mention how to iterate. As a new
user I spent a lot of time figuring this out.

Anonymous   
Printed Page 139
4th Method

The correct name of the method is EnumPrinterConnections, which is plural. The
printed copy is EnumPrinterConnection, which is singular.

In the description section, at the end of the paragraph, "the collection
returned....", should be "The collection returned...".

Anonymous   
Printed Page 148
Table 7-22

Under the "Key" heading, the values "My Documents" and "Start Menu" should
read "MyDocuments" and "StartMenu" respectively (i.e., no spaces).

Anonymous   
Printed Page 148
Table 7-22

The problem I see is that Table 7-22 shows the SpecialFolders Collections, but
it does not show the Temporary folder as one of them, which it is. I don't
know if this is a typo, because it does have the Templates Folder listed.

Anonymous   
Printed Page 185
line 13

"As Variant" isn't accepted by my version of CScript

Anonymous   
Printed Page 208
second bullet under CSng Function, Rules at a Glance

The second bullet under CSng Function, Rules at a Glance, now reads
If the value of expression is outside the range of the double
datatype, an overflow error is generated.

It should read:

If the value of expression is outside the range of the single
datatype, an overflow error is generated.

Anonymous   
Printed Page 209
CStr Function Example

Is "Dim sMyString as String".
Should be "Dim sMyString"

Anonymous   
Printed Page 241
First entry in table at the bottom of the page

The entry that reads "End Terminates program execution" should be removed. As is
clearly stated in the text, this form of End statement is not supported in VBScript.

Anonymous   
Printed Page 282
second bullet item from bottom

If ofs.FileExists(...
should read:
If ofs.FolderExists(...

Anonymous   
Printed Page 316
The first bullet under "Rules at a Glance" now reads

If maximum_value is greater than initial_value...

It should read:

If initial_value is greater than maximum_value...

Anonymous   
Printed Page 316
The first line of the example now reads:

For i = LBound(sArray) to LBound(sArray) Step - 1

It should read:

For LBound(sArray) to UBound(sArray) Step - 1

Anonymous   
Printed Page 343
IsEmpty Function, Rules at a Glance

Book states "If the variant passed to IsEmpy has been initialized, True is returned;
otherwise, IsEmpty returns False."

In my experience, True is returned if the variant is uninitialized, so an If IsEmpty
statement will execute if the variant is empty.

Anonymous   
Printed Page 354
second sentence

The 2nd line now reads:

The first character in the search string is at position 1

It should read:

The first character in the sentence is at position 0 (zero)

cfr: http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/script56/html/vsprofirstindex.asp

The FirstIndex property uses a zero-based offset from the beginning of the search
string. In other words, the first character in the string is identified as character
zero (0).

Anonymous   
Printed Page 367
2nd para under heading "VBA/VBScript Differences"

The paragraph reads:

"Once you enable error handling with the On Error Resume Next statement, VBScript
provides no means to disable it. This contrasts with VBA, in which the On Error Goto
0 statement disables error handling."

This incorrect. VBScript does support the On Error Goto 0 statement to disable error
handling.

Anonymous   
Printed Page 391
The Syntax description for RegExp.Replace.Method now reads

RegExp.Replace(string1, string1)

It should read:

RegExp.Replace(string1, string2)

Anonymous   
Printed Page 426
first bullet point, second bullet point, and the first full bullet point on the following page.

The value for vbArray is given as 8200 in the first and second bullet points on page 426, but the text of the second bullet point implies it's 8194. On page 427 it's given as 8194 but the text implies that it's 8192. 8192 seems to be the correct value, since it's a power of 2 (one set bit in a bitmask).

This is in the 10/07 printing.

Anonymous  Oct 19, 2008 
Printed Page 436
UBound Function Syntax

The description of the "arrayname" argument to UBound asserts that it must be the
name of an array. This is not true! All it needs to be is an array. It may be
referenced by name or in some other way. For example, "UBound(Array(1,2,3))" works
just fine. (This example is, of course, not a useful one!)

Anonymous   
Printed Page 451
section "Date and Time," the Day function

In the section "Date and Time," the Day function says that it returns the day of week when in fact it returns the day of the month.

Anonymous   
Printed Page 465
First table

"vbMsgBoxSetForeground" is broken between two lines. As a result, the two pieces
should be hyphenated as has been done with, for example, "vbMsgBoxRtlReading"
immediately above.

There are two more similar instances of missing hyphenation in the table at the
bottom of page 463.

Anonymous   
Printed Page 465
Table at bottom

"vbNullString" is defined as equating to the value "Zero Length String". This is
seriously incorrect. Microsoft's own documentation states that, it is "Not the same
as a zero-length string (""); used for calling external procedures." In fact it is a
NULL pointer.

Anonymous   
Printed Page 490
last entry for 'RegExp'

the 'RegExp.Text' method entry should be 'RegExp.Test'

Anonymous