#114046 - 2004-02-16 03:48 PM
Re: Fetching HTML from a Form Feed?
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Here is an old-school method, controlling the IE object.
The $sGT weirdness is just to get around posting problems.
Don't forget to change the form URL to the real comany name:
Break On ; vim600: ai sw=3 ts=3 $sGT="<" ; Form HTML $sHTML=''+$sGT+'HTML>' +' '+$sGT+'HEAD>'+$sGT+'TITLE>Employee User Name List'+$sGT+'/TITLE>'+$sGT+'/HEAD>' +' '+$sGT+'BODY BGCOLOR="#B2BCE9">'+$sGT+'FONT FACE="ARIAL,HELVETICA">' +' '+$sGT+'H3>Employee Standard User Name List'+$sGT+'/H3>' +' '+$sGT+'b>' +' '+$sGT+'FONT FACE="Comic Sans MS" SIZE=2 COLOR=black>' +' '+$sGT+'P> ' +' '+$sGT+'FORM Name=frmEmpInfo METHOD="POST" ACTION="http://intranet.mycompany.com/empinfo.asp">' +' Employee #:' +' '+$sGT+'INPUT Name=empno SIZE="12">' +' '+$sGT+'/FORM>' +' '+$sGT+'/FONT>' +' '+$sGT+'/BODY>' +''+$sGT+'/HTML>' ; Create Internet Explorer object $oIE = CreateObject("InternetExplorer.Application") ; The following lines tidy up the screen a bit, giving a semi-kiosk mode. $oIE.toolbar=0 $oIE.addressbar=0 $oIE.statusbar=0 $oIE.Navigate("about:blank") ; Wait for page to stop loading... While $oIE.busy AND $oIE.readystate <> 4 AND @ERROR = 0 Loop $oDoc=$oIE.document ; Now, add the starting form... $oDoc.Write($sHTML) While $oIE.busy AND $oIE.readystate <> 4 AND @ERROR = 0 Loop ; Comment out the next line if you don't want the form to appear (stealth mode) $oIE.Visible=1 ; The next line "autofills" the employee field. ; Note, we could just as well have coded the value in the HTML above, but this ; is an example of how to do control the form from within KiXtart $oDoc.frmEmpInfo.empno.value="12345" ; This sleep not required - it's just here to give the viewer an opportunity ; to see what is going on. Sleep 2 ; Here is the magic - submit the form. $oDoc.frmEmpInfo.submit() ; And wait for it to refresh... While $oIE.busy AND $oIE.readystate <> 4 AND @ERROR = 0 Loop ; Uncomment the next two line to close IE and clean up. ;$oIE.quit() ;$oIE=0
|
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 962 anonymous users online.
|
|
|