Thank You - so excited this sounds very possible.
If only i can get it to work - Please, Please help
I get the following Error in my vbscript code window:
Bad file name or number Location: Line: 28
Code: Select all
Call HTTPDownload ("http://biweb/Reportserver?http://srv08-za143/workspace/departments/IT/ReportsTest/R-MFS019+VendorInfo.rdl&rs:Command=Render&ProcessNo=6551&VENDOR=9999&Run=1&rs:Format=PDF", "E:")
Sub HTTPDownload( myURL, myPath )
' This Sub downloads the FILE specified in myURL to the path specified in myPath.'
' myURL must always end with a file name
' myPath may be a directory or a file name; in either case the directory must exist
'
' Written by Rob van der Woude' http://www.robvanderwoude.com
'
' Based on a script found on the Thai Visa forum
' http://www.thaivisa.com/forum/index.php?showtopic=21832
' Standard housekeeping
Dim i, objFile, objFSO, objHTTP, strFile, strMsg
Const ForReading = 1, ForWriting = 2, ForAppending = 8
' Create a File System Object
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
' Check if the specified target file or folder exists,
' and build the fully qualified path of the target file
If objFSO.FolderExists( myPath ) Then
strFile = objFSO.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
ElseIf objFSO.FolderExists( Left( myPath, InStrRev( myPath, "" ) - 1 ) ) Then
strFile = myPath
Else
WScript.Echo "ERROR: Target folder not found."
Exit Sub
End If
' Create or open the target file
Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True )
' Create an HTTP object
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
' Download the specified URL
objHTTP.Open "GET", myURL, False
objHTTP.Send
' Write the downloaded byte stream to the target file
For i = 1 To LenB( objHTTP.ResponseBody )
objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) )
Next
' Close the target file
objFile.Close( )
End Sub
The second option i got working but the file is corrupt i can't open the file, the file has been damaged
Code: Select all
Call Download ("http://biweb/Reportserver?http://srv08-za143/workspace/departments/IT/ReportsTest/R-MFS019+VendorInfo.rdl&rs:Command=Render&ProcessNo=6551&VENDOR=9999&Run=1&rs:Format=PDF", "E:.pdf")
Sub Download( myFileURL, myDestFile )
' This function uses X-standards.com's X-HTTP component to download a file
'
' Arguments:
' myFileURL [string] the URL of the file to be downloaded
' myDestFile [string] the fully qualified path of the downloaded "target" file
'' Written by Rob van der Woude
' http://www.robvanderwoude.com'
' The X-HTTP component is available at:
' http://www.xstandard.com/page.asp?p=C8AACBA3-702F-4BF0-894A-B6679AA949E6
' For more information on available functionality read:
' http://www.xstandard.com/printer-friendly.asp?id=32ADACB9-6093-452A-9464-9269867AB16E
Dim objHTTP
Set objHTTP = CreateObject("XStandard.HTTP")
objHTTP.Get myFileURL
objHTTP.SaveResponseToFile myDestFile
Set objHTTP = Nothing
End Sub
Please help - Thank You for getting me this far & great hope