|
|
|||||||
Anyone want to do a small paid job? I reckon a Kix script using SENDKEYs would do the job and given a price, I'm sure the client will pay to have it done. I need a script (Kix, Windows script, etc) that will do the following pseudo code as a timed event... Start Internet Explorer Run an executable on a known web site Wait till the process is done (maybe the delay might be determined by observation) When done, close Internet Explorer. Background: We presently FTP a zip file containing customer names, addresses and invoice details to the client website The web masters have given us a software that unzips the file and "absorbs" the data into the web site. We presently run the following DOS batch file each evening - works a treat except we end up with Internet Explorer screens staying open on the desktop. FTP -s:client.txt START /WAIT IEXPLORE http://123.123.123.123/client/invoice.cfc? EXIT |
||||||||
|
|
|||||||
Why not use FTPGet() UDF http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=83713 Don't think you need to pay anyone unless you're under the gun in a real hurry. Just need to post here and get it working the way you want. . |
||||||||
|
|
|||||||
Untested but this might work. Code: 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 |
||||||||
|
|
|||||||
I'm at liberty to offer payment by my client so happy to do that. I also seem to have given the wrong slant on the issue. The FTP process works fine and I'm not inclined to change that. The bit I can't seem to master is the actual closing of the IEXPLORE window after it has done the job. The line of code saying: START /WAIT IEXPLORE http://123.123.123.123/client/invoice.cfc? works beautifully but we end up with IEXPLORE screens litered all over the desktop. There is no command line switch that will close IEXPLORE after it has done the job. In other words we need a script to start IE, run the http://123 stuff, THEN CLOSE IE! Wouldn't it be good to have something like a /EXIT command that would do the job? |
||||||||
|
|
|||||||
Call something like this when you're sure the process is completed. Code: If Not @LogonMode Break On Else Break Off EndIf Dim $SO $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('NoMacrosInStrings','On') $SO=SetOption('WrapAtEOL','On') EndProc('IEXPLORE.EXE') Function EndProc($Proc) DIM $Process For Each $Process In GetObject("winmgmts:/root/cimv2").ExecQuery("Select * from Win32_Process where Name= " +'"'+$Proc+'"') $Process=$Process.Terminate Next Exit @ERROR EndFunction |
||||||||
|
|
|||||||
That's VERY elegant and generous. I will have access to the client's server during the weekend and am looking forward to studying your solution. I'll report back next week. Thanks again... Michael |
||||||||
|
|
|||||||
I couldn't wait till the weekend and tried the code on my own computer. It works a treat. Excellent work and thank you. Michael |
||||||||
|
|
|||||||
A little sidenote - you mentioned payment, as you know kixtart is Careware |
||||||||
|
|
|||||||
Thank you Bjorn for the reminder and excellent suggestion. I have today made a donation to the Australian National Breast Cancer Foundation - my wife is a breast cancer survivor! Thanks again to Mart, NTDOC and all who assisted. |
||||||||
|
|
|||||||
Happy to help. Great to see someone donating to a charity because he/she uses KiXtart |
||||||||
|
|
|||||||
Glad to be of assistance! I'm really happy to see that my suggestion was taken! |
||||||||
|
|
|||||||
Good job Bjorn and thanks Ash . |
||||||||
|
|
|||||||
Acctually Doc, I didn't assist in more than the suggestion, without your contributions to a solution, my suggestion would never had been taken, or so I think (ppl usually don't wanna pay for something broken ) |
||||||||
|
|
|||||||
You migth also want to let Ruud van Veelsen know about this donation as a result of the BBS support and KiXtart. I'm sure he'll be happy to hear such storesi as it validates his committment to KiXtart. |