我有多个网页需要打开并将信息(只是文本)保存到每个网页的新文件中。我在 VBScripts 方面完全没有经验。但是,我一直在寻找几天,这是我到目前为止收集到的:
function download(sFileURL, sLocation, async)
set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
objXMLHTTP.open "GET", sFileURL, async
on error resume next
objXMLHTTP.send()
if err.number = 0 then
do until objXMLHTTP.Status = 200
wscript.echo objXMLHTTP.Status
wcript.sleep(200)
loop
if objXMLHTTP.Status = 200 Then
set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0
set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(sLocation) Then objFSO.DeleteFile sLocation
Set objFSO = Nothing
objADOStream.SaveToFile sLocation
objADOStream.Close
set objADOStream = Nothing
download = true
end if
else
download = false
end if
set objXMLHTTP = Nothing
end function
if download("http://books.google.com/books/feeds/volumes?q=isbn", "test.txt", false) then
wscript.echo "download ok"
else
wscript.echo "download did not work"
end if
我怎样才能改变
if download("http://books.google.com/books/feeds/volumes?q=isbn", "test.txt", false)
从文本文件中的列表中读取,并保存为 test00, test01, test02,...
先感谢您