Break on
$ie = "C:\Program Files\Internet Explorer\iexplore.exe"
$source = "http://123.123.123.123/client/invoice.cfc"
$destination = "c:\invoice.cfc"
Shell $ie "http://www.somesite.com/someexe"
FTPget($source, $destination)
;Function: FTPget()
;
;Authors: Lonkero
; kdyer
;
;Version: 1.1 (6th of December 2002)
;
;Action: gets file from ftp or http server and saves it in specified file
;
;Syntax: FTPget("URL", "TARGET", "USERNAME", "PASSWORD")
;
;Parameters:
; URL - full url to the file to get
; TARGET - full path to file where to save
; USERNAME- optional, specifies username to use in connection
; PASSWORD- optional, specifies password to use in connection
;
;Returns:
; Nothing or errorcode on error.
;
; on error errorcodes returned and set:
; 1 -failed to initialize http-object
; 2 -failed to initialize ADODB-object
; 3 -failed to open connection
; 4 -ADO write failed
; 5 -save to file failed
;
;Dependencies:
; IE5 or higher
;
;Remarks:
; if file exists, it will be overwritten.
; not sure about the ado, dependency?
;
;Example:
; "Downloading TypelibViewer, Please standby..."
; if FTPget("http://www.rwksystems.com/files/TypeLibViewer.exe","%temp%\typelibViewer.exe")
; "error occured:" @error
; else
; "Download complete. file is saved in %temp% as typelibViewer.exe"
; endif
;
;Source:
Function FTPget($sURL, $sTargetFile, optional $sUser, optional $sPass)
Dim $oFTP, $oStream
$sUser=""+$sUser
$oFTP = CreateObject("Microsoft.XMLHTTP")
If @error $ftpget=1 Exit 1 EndIf
$oStream = CreateObject("ADODB.Stream")
If @error $ftpget=2 Exit 2 EndIf
If $sUser
$oFTP.Open("GET", $sURL, Not 1, $sUser, $sPass)
Else
$oFTP.Open("GET", $sURL, Not 1)
EndIf
If @error $ftpget=3 Exit 3 EndIf
$oFTP.Send
$oStream.Type = 1
$oStream.Mode = 3
$oStream.Open
$oStream.Write($oFTP.responseBody)
If @error $ftpget=4 Exit 4 EndIf
$oStream.SaveToFile($sTargetFile, 2)
If @error $ftpget=5 Exit 5 EndIf
$oStream.Close
EndFunction