VBscript对象需要800A01A8

时间:2014-08-09 09:36:02

标签: windows vbscript

请帮忙。无法使此代码工作。它需要一个物体。不知道如何解决这个问题。我看到我的脚本没有拼写错误。我正在尝试检查我的PC中是否有对https://www.test.com开放的Internet Explorer。学校项目急需。提前致谢

Option Explicit
Dim objShell, objShellWindows, i, objIE
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows

For i = 0 to objShellWindows.Count - 1
    Set objIE = objShellWindows.Item(i)
    strURL = objIE.LocationURL
    If InStr(strURL, "https://www.test.com/")Then
        blnFound = True
    End If
Next

1 个答案:

答案 0 :(得分:0)

下面的代码将检查IE中加载的所有URL,
请注意,当bFound位于sURL内时,此处.LocationURL为True,而不是以Option Explicit Const sURL = "https://www.test.com/" Dim oShell, oWindow, oIE, bFound Set oShell = CreateObject("Shell.Application") bFound = False For Each oWindow In oShell.Windows If InStr(1,oWindow.Fullname,"iexplore.exe",vbTextCompare) > 0 Then Set oIE = oWindow With oIE 'Wscript.Echo .LocationURL bFound = (InStr(1,.LocationURL,sURL,vbTextCompare) > 0) If bFound Then Exit For End With Set oIE = Nothing End If Next If bFound Then Wscript.Echo sURL & " is loaded" Else Wscript.Echo sURL & " is NOT loaded" End If Set oShell = Nothing 开头。根据您的需要进行修改。

{{1}}