[tt]dim surl,slocal,oxmlhttp,ostream
[green]surl="
slocal="h:\test\cad.gif"[/green]
on error resume next
set oxmlhttp=createobject("msxml2.xmlhttp")
if err.number<>0 then
wscript.echo "msxml2.xmlhttp not installed. Operation aborted."
wscript.quit(1)
end if
with oxmlhttp
.open "get",surl,false
.send
end with
if err.number<>0 then
wscript.echo "Resource unavailable for varied reasons. Operation aborted."
set oxmlhttp=nothing : wscript.quit(2)
end if
set ostream = createobject("adodb.stream")
with ostream
.type=1 'binary
.mode=3 'read-write
.open
.write oxmlhttp.responsebody
.savetofile slocal,2 'save-create-overwrite
.close
end with
if err.number<>0 then
wscript.echo "You need ado2.5 up. Operation aborted"
else
wscript.echo "Done!" & vbcrlf & "Source : " & surl & vbcrlf & "Local : " & slocal
end if
on error goto 0
set ostream=nothing : set oxmlhttp=nothing
[/tt]