vbs批量打开url页面
上一篇 /
下一篇 2012-05-22 15:09:43
/ 个人分类:自动化测试
'------------------------------------------------------------------------
Const domain="" '需要批量打开的域名,例如www.baiducom
Const inputfile="url.txt" '输入文件
Const utputfile="url##.txt" '输出文件
Const MAX=10 '一次批量打开页面数
'------------------------------------------------------------------------
'判断url.txt是否存在
Set Fso=CreateObject("Scripting.FileSystemObject")
If Fso.FileExists(inputfile) Then
Set input = Fso.OpenTextFile(inputfile)
Else
msgbox "文件"&inputfile&"不存在"
Wscript.Quit
End If
'输出文件
Set utput = Fso.OpenTextFile(outputfile,8,True) '以Appending方式打开文件,不存在文件时则创建
Set WshShell=wscript.CreateObject("WScript.Shell")
For i = 1 To MAX
If input.atEndOfStream Then Exit For
str = input.Readline
output.Writeline str
wshshell.run "firefox.exe -new-tab "&str&domain '新标签页中打开站点
Next
If Not input.atEndOfStream Then
str = input.Readall 'readall为读取当前文件指针位置到文件末尾的所有内容
Else
EOFflag = True
End If
input.close
Set input = Fso.CreateTextFile(inputfile)
If Not EOFflag Then
input.write str
Else
MsgBox "执行完毕" '批量打开网站的vbs脚本结束后提示执行完毕
End If
input.close
Set input = Nothing
output.close
Set utput = Nothing
Set WshShell = Nothing
Set Fso = Nothing
'以上为批量打开网站的vbs脚本
'使用方法:脚本同一目录下存在需要批量打开的url.txt文件,首先打开Firefox浏览器,双击openurl.vbs即可
收藏
举报
TAG: