я выбираю папку, а код категорически не хочет сохранять файл туда. при этом никаких сообщений об ошибке не выдает.
strSources = "http://123.doc" p> strDests = "c:\temp\1\123.doc"
If filesys.folderExists("c:\temp\1\") Then
Set HTTPs = WScript.CreateObject("Microsoft.XMLHTTP")
HTTPs.Open "GET", strSources, False
HTTPs.send
Set Streams = CreateObject("adodb.stream")
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
Streams.Type = adTypeBinary
Streams.Open
Streams.write HTTPs.responseBody
Streams.savetofile strDests,adSaveCreateOverWrite
set Streams = Nothing
Set HTTPs = Nothing
else
dim objDlg, objF
set objDlg=WScript.createObject("Shell.application")
set objF= objDlg.browseForFolder(0, "Select folder", 0, "c:\")
if (not objF is nothing) then
Set HTTPs = WScript.CreateObject("Microsoft.XMLHTTP")
HTTPs.Open "GET", strSources, False
HTTPs.send
Set Streams = CreateObject("adodb.stream")
Streams.Type = adTypeBinary
Streams.Open
Streams.write HTTPs.responseBody
Streams.savetofile (objF),adSaveCreateOverWrite
set Streams = Nothing
Set HTTPs = Nothing
end if
set objFolder = nothing
end if
Ответить
|