Here is the function to download any file over internet using XMLHTTP COM objects in VBScript. Function Download ( sFileURL, sLocation ) 'create xmlhttp object Set objXMLHTTP = CreateObject ( "MSXML2.XMLHTTP" ) 'get the remote file objXMLHTTP. open "GET" , sFileURL, false 'send the request objXMLHTTP.send ( ) 'wait until the data has downloaded successfully do until objXMLHTTP.Status = 200 : wscript.sleep ( 1000 ) : loop 'if the data has downloaded sucessfully If objXMLHTTP.Status = 200 Then 'create binary stream object Set objADOStream = CreateObject ( "ADODB.Stream" ) objADOStream. Open 'adTypeBinary objADOStream. Type = 1 objADOStream.Write objXMLHTTP.ResponseBody 'Set the stream position to the start objADOStream.Position = 0
Sharing ideas with automation testers and Enjoying the ride...