我需要自动运行此脚本,但使用urllist.txt文件中指定的不同url。重复多个网址的vbs脚本
Dim objWshShell,IE,searchStr
Set objWshShell = Wscript.CreateObject("Wscript.Shell")
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate "url.com"
Do While .Busy
WScript.Sleep 100
Loop
set objButtons = IE.document.getElementsByTagName("button")
for each objButton in objButtons
strText = objButton.innerhtml
if InStr(strText,"rtes") > 0 then
'msgbox strText
objButton.click
exit for
end if
next
end with
ie.quit
内容urllist.txt中:
url1.com url2.com ...
能否请你帮忙吗?
逐行读取使用的文件系统对象的文本文件行。对于每一行,执行你粘贴的代码。 – Gurman
谢谢。现在我可以从urllist.txt读取URL。 如何导航我的脚本到这些URL并让脚本完成这项工作? 我加入这个在VBScript中的顶部: 文件名= “urllist.txt中” 设置FSO =的CreateObject( “Scripting.FileSystemObject的”) 集F = fso.OpenTextFile(文件名) 做,直到f.AtEndOfStream WScript.Echo f.ReadLine Loop f。关闭 –
刚刚发布在答案中。只需将您的url文件的路径存储在变量中并运行代码即可。 – Gurman