#105525 - 2003-10-15 04:14 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
No luck with the amended URL. This is a secure web page (https) I added the "s" to your suggestion but to no avail. Unfortunately your URL isn't passing the login parameters. I've got an idea for a workaround solution, which is to have the script ask and make sure the site has been logged into before running the update on the second page because as I said in a previous post I can open a second instance of the 2nd
|
Top
|
|
|
|
#105527 - 2003-10-17 12:48 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
GOT IT!
It took two commands to submit the form. Thanks Lonkero, for keeping me thinking.
code:
Break On
$ID = 'name'
$PW = 'pwd'
$URL = "https://169.218.223.124/script/lb_login.asp"
$IE = CreateObject("InternetExplorer.Application")
$IE.Visible = 1
$IE.Navigate($URL)
While $IE.Busy and $IE.ReadyState <> 4 and @ERROR = 0 Loop
$IE.Document.getelementbyid("custid").Value = $ID
$IE.Document.getelementbyid("pw").Value = $PW
$IE.Document.lblogin.posting.value = 1
$IE.Document.lblogin.Submit()
Exit 0
Now, on to stage two...
|
Top
|
|
|
|
#105528 - 2003-10-17 07:01 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
I pretty much have the rest of my script written but I have another question.
if:
$pts = '5.5' or: $pts = '5.51'
How do I append the zeros to the end of the value so that whatever the value of $pts I will always have a number to 3 decimals? The value of $pts comes from a "gets" statement. [ 17. October 2003, 07:04: Message edited by: jacks73 ]
|
Top
|
|
|
|
#105531 - 2003-10-18 07:01 PM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
Lonkero, I know your url probably should have worked but I couldn't get it to.
Richard, Thanks for pointing me to formatnumber it is just what I needed.
here's the code that I have so far
code:
Break On
$ID = 'name'
$PW = 'pwd'
do ?'Enter 30 Year Fixed Conforming Rate>' gets $rte44 until $rte44 do ?'Enter 30 Year Fixed Conforming Points>' gets $pts44 until $pts44 do ?'Enter 30 Year Fixed Conforming APR (Enter X to auto calculate)>' gets $apr44 until $apr44 do ?'Enter 30 Year Fixed Conforming lock>' gets $lck44 until $lck44 if $apr44 = 'x' $apr44 = '' else $apr44=formatnumber($apr44,3) endif
$rte44=formatnumber($rte44,3) $pts44=formatnumber($pts44,3)
:time do ?'Please enter the update frequency for today (5,10,15)>' gets $sleep until $sleep
if $sleep <> 5 if $sleep <> 10 if $sleep <> 15 ?'Updates can only be preformed at 5, 10, or 15 min intervals please re-enter!' goto time endif
:again
$URL = "https://169.218.223.168/script/lb_login.asp"
$IE = CreateObject("InternetExplorer.Application")
$IE.Visible = 1
$IE.Navigate($URL)
While $IE.Busy and $IE.ReadyState <> 4 and @ERROR = 0 Loop
$IE.Document.getelementbyid("custid").Value = $ID
$IE.Document.getelementbyid("pw").Value = $PW
$IE.Document.lblogin.posting.value = 1
$IE.Document.lblogin.Submit()
$IE.Document.getelementbyid("4004rate").Value = "$rte44" $IE.Document.getelementbyid("4004points").Value = "$Pts44" $IE.Document.getelementbyid("4004apr").Value = "$apr44" $IE.Document.getelementbyid("4004lock").Value = "$lck44"
$IE.document.fixrates.posting.value = 1 $IE.document.fixrates.submit()
sleep 2
$url2='https://169.218.223.168/script/adjrates.asp'
$IE.Navigate($URL2)
$val = 2
sleep 2
$IE.Document.getelementbyid(4006index)."option value" = $val;dropdown box
$IE.document.adjrates.posting.value = 1 $IE.document.adjrates.submit()
if $sleep=5 sleep 300 endif if $sleep=10 sleep 600 endif if $sleep=15 sleep 900 endif
call var_rate.kix
if @TIME <> '4:*:*' goto again endif
Exit 0
My next problem is how to select an option from the dropdown box. I've tried code:
$IE.Document.getelementbyid(4006index).option = $val $IE.Document.getelementbyid(4006index).value = $val
but none will access any of the options. Any ideas
here's the segment of the html that defines it
code:
<td width="86"> <select name="4006index" size="1" onBlur="onBlur_Checkvalue(this,8)"> <option value="1" selected >1Yr TBill</option> <option value="2" >3Yr TBill</option> <option value="3" >COFI</option> <option value="4" >LIBOR</option> <option value="5" >Other</option> </select> </td>
I've tried [ 18. October 2003, 19:03: Message edited by: jacks73 ]
|
Top
|
|
|
|
#105533 - 2003-10-18 07:16 PM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
OOPS! Never mind I just forgot some quotes
code:
$IE.Document.getelementbyid("4006index").value = $val
Sorry
|
Top
|
|
|
|
#105534 - 2003-10-18 07:19 PM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
Jens, Sorry about the goto's I'll post without them when I get everything worked out.
|
Top
|
|
|
|
#105535 - 2003-10-23 04:27 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
Hello everyone, Thank you all for your help in posts past. I've just about got my script finished, but I've run into a bit of a snag. While I am able to login into the first page, and then I can enter the necessary information on the next page, I can not get the second page to save said info.
Here's my code
code:
;Set User Id and Password $ID = 'name'
$PW = 'pwd' $cnrfm7 ='z'
while $cnfrm7 = 'z' ;Get Values for to update on the fixed rate page do ?'Enter 30 Year Fixed Conforming Rate>' gets $rte44 until $rte44 do ?'Enter 30 Year Fixed Conforming Points>' gets $pts44 until $pts44 do ?'Enter 30 Year Fixed Conforming APR (Enter X to auto calculate) >' gets $apr44 until $apr44 do ?'Enter 30 Year Fixed Conforming lock>' gets $lck44 until $lck44 ; Format the numeric values to 3 decimal places. For the 'apr' variables ; this will change an 'x' entry to null for auto calculation by the webpage if $apr44 = 'x' $apr44 = '' else $apr44=formatnumber($apr44,3) endif
$rte44=formatnumber($rte44,3) $pts44=formatnumber($pts44,3)
do ?'You have entered:' ?' 30 Year Fixed Conforming Rate = $rte44' ?' 30 Year Fixed Conforming Points = $pts44' ?' 30 Year Fixed Conforming APR = $apr44' ?' 30 Year Fixed Conforming Lock = $lck44' ?'Are these values correct? (Y/N) >' gets $cnfrm7 until $cnfrm7 ;Loop until either a "y" or a "n" is entered while $cnfrm7 <> 'Y' and $cnfrm7 <> 'N' do ?'Please enter Y or N>' gets $cnfrm7 until $cnfrm7 loop loop
$URL = "https://www.the_site.com/script/lb_login.asp"
$IE = CreateObject("InternetExplorer.Application")
$IE.Visible = 1
$IE.Navigate($URL)
sleep 1 sendkeys('y') ;clears the certificate warning popup window
While $IE.Busy and $IE.ReadyState <> 4 and @ERROR = 0 Loop
$IE.Document.getelementbyid("custid").Value = $ID $IE.Document.getelementbyid("pw").Value = $PW
$IE.Document.lblogin.posting.value = 1 $IE.Document.lblogin.Submit()
;Enters the loan information to each applicable field on the fixedrates.asp page
$IE.Document.getelementbyid("4004rate").Value = "$rte44" $IE.Document.getelementbyid("4004points").Value = "$pts44" ;$IE.Document.getelementbyid("4004apr").Value = "$apr44" $IE.Document.getelementbyid("4004lock").Value = "$lck44"
$date = @date
while @date = $date sleep 900 ; Saves the updated values for the happy.asp page
;This is the part that isn't working
$IE.document.fixrates.posting.value = 1 $IE.document.fixrates.submit() loop
here' the HTML from the first page (the one I can get to work code:
<script> <!-- function login_onclick() { // Validations if ( isNaN(document.lblogin.custid.value)) { alert( "Please enter a valid ID" ); document.lblogin.custid.focus(); return; }
if ( document.lblogin.custid.value=="" ) { alert( "Please enter ID" ); document.lblogin.custid.focus(); return; } if ( document.lblogin.pw.value=="" ) { alert( "Please enter Password" ); document.lblogin.pw.focus(); return; } // all is well document.lblogin.posting.value = 1 document.lblogin.submit(); return; } //--> </script>
here's the HTML of the page that's not working code:
<script> <!-- function save_onclick() { // NOTE: many lines commented out are a stub for the // allowance of negative points in the future. var numvals="0123456789."; //var tempnumvals = numvals; var dcnt; //var negs; var temp; var e; var i,j,k; var ispoints = false; // Validations - make sure all inputs are numeric for ( i=0; i < document.fixrates.length ; i++ ) { dcnt = 0; negs = 0; e = document.fixrates.elements[i]; if ( e.type == "text" ) { // if field is points add "-" as a valid value /*if (e.name.match("points")) { numvals += "-"; ispoints = true; } */ for ( j=0; j < e.value.length; j++) { temp=e.value.substring(j,j+1) if ( temp == "." ) dcnt++; /*if (ispoints == true) { if ( temp == "-" ) { negs ++; if (e.value.indexOf(temp) > 0) { alert ("Please enter a valid number." ); field.focus(); return; } } } */ //if ( ( numvals.indexOf(temp)==-1) || ( dcnt > 1 ) || ( negs > 1) ) if ( ( numvals.indexOf(temp)==-1) || ( dcnt > 1 )) { alert( "Please enter a valid number." ) e.focus(); return; } }
if ( isNaN( parseFloat( e.value ) ) ) { alert( "Please enter a valid number." ); e.focus(); return; } // ispoints and okay value - revert numvals to prior state //numvals = tempnumvals; } } //This, jacks73 has determined, is the part I need help on document.fixrates.posting.value = 1; for (x=5; x<document.fixrates.length -4; x=x+ 7) {
document.fixrates.elements[x].disabled=false; } document.fixrates.submit(); return; }
How do I pass the "extra parameters" from the script? Again all help is appreciated
Thanks, J [ 23. October 2003, 04:34: Message edited by: jacks73 ]
|
Top
|
|
|
|
#105537 - 2003-10-23 04:45 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
Both
0, The operation has completed successfully
but the page doesn't save my new info
|
Top
|
|
|
|
#105538 - 2003-10-23 04:49 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
I have also tried;
$IE.document.fixrates.posting.value = 1 $IE.document.fixrates.elements(x).disabled=0 $IE.document.fixrates.submit()
With the same results for all three.
BTW good morning
|
Top
|
|
|
|
#105540 - 2003-10-23 05:01 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
Shawn my friend, 75% of the KiXtart/HTML interaction I have learned from you. I suppose your suggestion could be done but how...?
I don't necessarily wan't a silver platter but a sense of direction would be awesome.
|
Top
|
|
|
|
#105542 - 2003-10-23 05:22 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
It's a secure site. If I could let you in I would. However, when the "save" button is hovered, save_onclick (the name of the HTML function posted) is shown in the status bar of IE [ 23. October 2003, 05:24: Message edited by: jacks73 ]
|
Top
|
|
|
|
#105544 - 2003-10-23 06:16 AM
Re: Is it possible to update a web page with a KiXtart script?
|
jacks73
Getting the hang of it
Registered: 2003-04-23
Posts: 58
|
Tried code:
; Saves the updated values for the fixedrates.asp page $IE.document.fixrates.posting.value = 1 ? @error @serror $IE.document.fixrates("javascript:save_onclick").click() ? @error @serror
With the same results
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 202 anonymous users online.
|
|
|