我想使用VBScript执行以下操作:
打开网址
strURL =“www.abc.com”
设置objShell = CreateObject(“Wscript.Shell”)
objShell.Run(strURL)
2。在URL中找到第一个下载链接,其中包含一个字符串“abcd”
我有打开URL的脚本,因此完成了第1和第3个。 如果有人能帮助我完成第二步,那就太棒了!
谢谢!
答案 0 :(得分:0)
您的代码将隐式启动IE(或者无论您的默认浏览器是什么)。然而,最好是显式地启动它,以便您可以控制它。例如:
' Launch Internet Explorer...
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate strURL
' Wait for page to load...
Do While ie.Busy
WScript.Sleep 100
Loop
' Get all the links on the page...
Set Links = ie.document.getElementsByTagName("a")
' Find the first link whose URL contains the text "abcd"...
For Each Link In Links
If InStr(1, Link.href, "abcd", vbTextCompare) > 0 Then
' Found it. Load it.
ie.Navigate Link.href
Exit For
End If
Next