Update: If you are an iTunes user that needs VBScript, this page won’t help you. Please visit the following two sites for two different solutions: Apple Docs and KeathMilligan.net.
This is an old script I dug up which I call “fileFetch”. It’s a script that downloads a binary file using XMLHTTP and saves it using an ADO stream. This is handy for nightly downloads and will work within SQL Server DTS packages.
‘ Set your settings
strFileURL = “http://www.domain.com/file.zip”
strHDLocation = “D:\file.zip”
‘ Fetch the file
Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)
objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject(“ADODB.Stream”)
objADOStream.Open
objADOStream.Type = 1 ‘adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 ‘Set the stream position to the start
Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
Recent Comments