Page 1 of 1 1
Topic Options
#182716 - 2007-11-15 10:20 PM Read Data from Internet explorer
SeaDub Offline
Fresh Scripter

Registered: 2007-11-15
Posts: 8
I'm using KiXtart to input basic data into an Internet explorer window. Basically, it copies the data from a big excel list, and using sendkeys, it pastes the code into the Internet explorer window (using tab to get to the next field, etc).
Unfortunately (yes, theres always an "Unfortunately") the Internet Explorer window that I'm inputing data into has an SAP backend, so it takes time to move on to the next record.
Sendkeys does not "wait" for internet explorer to get to the next record before it tries to "Type" the data into the field, so in the end, I lose data.
From what I can think of, I have 2 solutions.
1) Is there a way to make Sendkeys WAIT until Internet explorer is ready before it proceeds?
2) Is there a way for me to put Sendkeys in a for loop, and the only time it exits is when internet explorer is ready? Thinking maybe I could do a copy and paste, and if the Copy is EMPTY, then internet explorer isn't ready, but if the Copy shows DATA, that means that Internet explorer is ready.

I either totally confused you, or you got what I'm trying to do. Any ideas?

Thanks so much for your help.

Top
#182717 - 2007-11-15 10:23 PM Re: Read Data from Internet explorer [Re: SeaDub]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Well you could sleep before each sendkey I suppose but there is actual software on the Web that is designed specifically for this task already that as I recall is not very expensive and there may even be some free version of some site like SourceForge

I would check that out myself maybe, otherwise try adding sleeps between send key information.

Top
#182720 - 2007-11-16 04:04 AM Re: Read Data from Internet explorer [Re: NTDOC]
SeaDub Offline
Fresh Scripter

Registered: 2007-11-15
Posts: 8
Well the sleeps WOULD work, its just that.. sometimes SAP is fast, and sometimes its slow... so if I did like, 10 second sleeps... to ensure it worked... it would run awful slow.. thats why I was trying to make it "efficent"...

Any idea what that software was called?

Top
#182721 - 2007-11-16 04:12 AM Re: Read Data from Internet explorer [Re: SeaDub]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
You could use com instead... see the following thread and see if it will get you going...

http://www.kixtart.org/forums/ubbthreads...true#Post100947

Top
#182722 - 2007-11-16 04:12 AM Re: Read Data from Internet explorer [Re: SeaDub]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Well I don't use any so can't recommend a specific one, but I know they exist.


Couple places to look though, but you can do some Google searching for more.


http://www.dirfile.com/freeware/form-filler.htm

http://forums.mozillazine.org/viewtopic.php?p=3020271&

http://www.filedudes.com/files/Auto_Fill_Forms.html

Top
#182723 - 2007-11-16 05:05 AM Re: Read Data from Internet explorer [Re: SeaDub]
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Hi,

I don't know how applicable this is to your situation, but assuming you want deal with SAP, and if you're up for it, you may wish to talk directly to it. SAP supports SOAP which is a fairly simple protocol to communicate through. To get you started, below is my function for communication via a SOAP web method along with some sample usage. This link may be of help as well SAP and SOAP Bindings

 Code:
$Server="ims.csiro.au"
$Path="/WebService/Service.asmx?wsdl"

$SoapParameters = CreateObject("Scripting.Dictionary")
$SoapParameters.Add("XmlDoc", $XmlDoc.xml)
$SoapParameters.Add("uniqueids", $aUniqueid)
$SoapParameters.Add("Client", "Windows")
$SOAP = WebMethod($Server, $Path, "ProcessXmlDataSet", $SoapParameters)

Function WebMethod($Server, $Path, $MethodName, $SoapParameters)

	Dim $Data,$Parameter,$Value,$oHttp,$Envelope,$Response,$Ticks
	For Each $Parameter in $SoapParameters.Keys
		$Data = $Data + '<'+ $Parameter + '>'
		$Value = $SoapParameters.Item($Parameter)
		If VarType($Value) & 8192
			$Data = $Data + '<string>' + Join($Value, '</string><string>') + '</string>'
		Else
			$Data = $Data + $Value
		EndIf
		$Data = $Data + '</' + $Parameter + '>'
	Next
	; create an XmlHttp instance
	$oHttp = CreateObject("Msxml2.XMLHTTP")
	; Create the SOAP Envelope
	$Envelope = 	'<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
					'	<soap:Envelope ' +
					'	xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
					'	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
					'	xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"' +
					'	xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
					'	<soap:Body>' +
            		'    <' + $MethodName + ' xmlns="http://' + $Server + '/">' +
							$Data +
            		'    </' + $MethodName + '>' +
					'	</soap:Body>' +
					'</soap:Envelope>'

	; send the POST to the Web service
	$oHttp.open("POST", "http://" + $Server + $Path, Not 1)
	$oHttp.setRequestHeader("SOAPAction", '"http://' + $Server + '/' + $MethodName + '"')
	$oHttp.setRequestHeader("Content-Type", 'text/xml; charset="utf-8"')
	$oHttp.setRequestHeader("Connection", "close")
	$oHttp.send($Envelope)
	$Ticks=@TICKS
	; a readyState of 4 means we're ready to use the data returned by XMLHTTP
	While $oHttp.readyState<>4
		If @TICKS-$Ticks>3000 Exit 1 EndIf
	Loop
	$Response = $oHttp.responseBody
	If InStr($Response,'<' + $MethodName + 'Result>') And InStr($Response,'</' + $MethodName + 'Result>')
		$Response = SubStr($Response, InStr($Response,'<' + $MethodName + 'Result>') + Len('<' + $MethodName + 'Result>'))
		$WebMethod = Left($Response, InStr($Response,'</' + $MethodName + 'Result>') - 1)
	EndIf
	
EndFunction


Cheers,

Richard

Top
#182728 - 2007-11-16 10:21 AM Re: Read Data from Internet explorer [Re: It_took_my_meds]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
If none of the above suit you and you really want to stick with the sendkeys approach then look at something like AutoIT http://www.autoitscript.com

It has it's own scripting language, or you can use the COM object to control it from KiXtart.

AutoIT allows you to peek at the Window content, so that you can check on progress and wait for events.

Oh, and it costs nowt.

Top
#182748 - 2007-11-16 09:42 PM Re: Read Data from Internet explorer [Re: Richard H.]
SeaDub Offline
Fresh Scripter

Registered: 2007-11-15
Posts: 8
Sounds good, I'll take a look into AutoIT and COM as well.

Thanks for your help!

Top
#182750 - 2007-11-16 10:00 PM Re: Read Data from Internet explorer [Re: SeaDub]
SeaDub Offline
Fresh Scripter

Registered: 2007-11-15
Posts: 8
Alright... I found Witto's CopyToClipboard UDF... This could help me if I could figure out a way to Paste the value into a variable...

Anyone know if you can paste from your clipboard into a variable?

Thanks!

Top
#182753 - 2007-11-16 11:30 PM Re: Read Data from Internet explorer [Re: SeaDub]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Maybe PasteFromClipboard() ?
Top
#182759 - 2007-11-17 08:09 PM Re: Read Data from Internet explorer [Re: Witto]
SeaDub Offline
Fresh Scripter

Registered: 2007-11-15
Posts: 8
WOW. OK I'm an idiot.. Thanks for the help. That should get it working..
Top
#182795 - 2007-11-19 05:55 PM Re: Read Data from Internet explorer [Re: SeaDub]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I don't get how these functions solve your problem...
Maybe you can show us some of your code?

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
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.069 seconds in which 0.028 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