我有一个 VBScript 代码,它给我一个错误,提示“需要对象”
错误 800A01A8 位于第 11 行和第 3 个字符。
这是代码:
Dim strWebsite
strWebsite = "78.72.111.138:80"
If PingSite( strWebsite ) Then
Dim xHttp: Set xHttp = CreateObject("Microsoft.XMLHTTP")
Dim bStrm: Set endbStrm = CreateObject("Adodb.Stream")
xHttp.Open "GET", "http://?/batch/down.php", False
xHttp.Send
With bStrm
.Type = 1 '//binary
.Open
.Write xHttp.responseBody
.SaveToFile "link.txt", 2 '//overwrite
End With
Else
End If
Function PingSite( myWebsite )
Dim intStatus, objHTTP
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
objHTTP.Open "GET", "http://" & myWebsite & "/", False
objHTTP.SetRequestHeader "User-Agent", _
"Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"
On Error Resume Next
objHTTP.Send
intStatus = objHTTP.Status
On Error Goto 0
If intStatus = 200 Then
PingSite = True
Else
PingSite = False
End If
Set objHTTP = Nothing
End Function
错误是。
You Dim bStrm
,但初始化endbStrm
:
dim bStrm: Set endbStrm = createobject("Adodb.Stream")
证据:
>> Dim x
>> With x
>> .Type = 1
>> End With
>>
Error Number: 424
Error Description: Object required
>>
Use Option Explicit
以避免此类错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)