Page 1 of 1 1
Topic Options
#172332 - 2007-01-03 10:05 AM Quote needed for script job
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
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

Top
#172333 - 2007-01-03 10:54 AM Re: Quote needed for script job [Re: Ashpoint]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
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.

.

Top
#172342 - 2007-01-03 04:09 PM Re: Quote needed for script job [Re: NTDOC]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
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
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#172351 - 2007-01-04 01:27 AM Re: Quote needed for script job [Re: NTDOC]
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
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?




Edited by Ashpoint (2007-01-04 01:29 AM)

Top
#172352 - 2007-01-04 02:03 AM Re: Quote needed for script job [Re: Ashpoint]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
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

Top
#172353 - 2007-01-04 03:33 AM Re: Quote needed for script job [Re: NTDOC]
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
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

Top
#172355 - 2007-01-04 05:41 AM Re: Quote needed for script job [Re: Ashpoint]
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
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

Top
#172366 - 2007-01-04 11:00 AM Re: Quote needed for script job [Re: Ashpoint]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
A little sidenote - you mentioned payment, as you know kixtart is Careware ;\)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#172420 - 2007-01-05 02:22 AM Re: Quote needed for script job [Re: Björn]
Ashpoint Offline
Starting to like KiXtart

Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
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.

Top
#172426 - 2007-01-05 10:22 AM Re: Quote needed for script job [Re: Ashpoint]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Happy to help.

Great to see someone donating to a charity because he/she uses KiXtart
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#172427 - 2007-01-05 11:20 AM Re: Quote needed for script job [Re: Ashpoint]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Glad to be of assistance! I'm really happy to see that my suggestion was taken!
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#172428 - 2007-01-05 11:24 AM Re: Quote needed for script job [Re: Björn]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Good job Bjorn and thanks Ash

.

Top
#172429 - 2007-01-05 11:26 AM Re: Quote needed for script job [Re: NTDOC]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
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 ;\) )
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#172472 - 2007-01-06 08:24 PM Re: Quote needed for script job [Re: Björn]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
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.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.065 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org