Page 3 of 3 <123
Topic Options
#105545 - 2003-10-23 10:08 AM Re: Is it possible to update a web page with a KiXtart script?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Be very careful with your use of case. KiXtart is case-insentitive, JavaScript is not.

You've mixed "Value" and "value", and these may well refer to different things.

I've frequently spent time staring at code which is obviously correct for ages before spotting case issues.

I'm a little confused why you have both console and GUI input - are you going to create an IE input page later?

Also, what do you mean by "how do I pass the extra parameters"?

Top
#105546 - 2003-10-23 11:15 AM Re: Is it possible to update a web page with a KiXtart script?
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Richard,
Thanks for your help. I will change the case issue in my code.
quote:
I'm a little confused why you have both console and GUI input - are you going to create an IE input page later?
The console input is to get the variable info at the begining of each day. Then the script will go to the site and re-save the same info at specified intervals throughout the day.

quote:
Also, what do you mean by "how do I pass the extra parameters"?
That question comes from this

My code:
code:
 $IE.Document.lblogin.posting.value = 1
$IE.Document.lblogin.Submit()

The HTML code it affects
code:
 // all is well
document.lblogin.posting.value = 1
document.lblogin.submit();
return;

The HTML code of the 2nd page that I want to also affect(this comes from the same approx area of the source as the first.
code:
 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;

There are extra statements that I'm think may be needed in my script but I don't know how to incorporate them.

[ 23. October 2003, 11:16: Message edited by: jacks73 ]

Top
#105547 - 2003-10-23 04:45 PM Re: Is it possible to update a web page with a KiXtart script?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ok well, if possible wouldn't mind seeing the source for this second page, can't speak for Richard but would be good if he could have a look as well - I know he has alot of experience in these matters. If you could just post it or email it to us (if sensitive) would be great ...

In the short term, could you just verify that the objects your accessing are actually there and created, maybe run this code:

code:
$Posting = $IE.document.fixrates.posting

If $Posting
?"Posting is real, value is " + $Posting.Value
Endif

$FixRates = $IE.document.fixrates

If $FixRates
?"FixRates is real"
Endif

At least doing this, we will know we're deailing with real objects ...

-Shawn

[ 23. October 2003, 16:51: Message edited by: Shawn ]

Top
#105548 - 2003-10-25 02:01 AM Re: Is it possible to update a web page with a KiXtart script?
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
OK Shawn I tried the code you posted.

and the results are strange.

whent the code runs it hits the if $posting statement and then goes on to the ?"Posting is real, value is " + $Posting.Value as though the if was true. and then nothing is printed. Then it hit the next if and prints 'Fixrates is real'

$ID = 'name'

$PW = 'pwd'

$URL = "https://www.thesite.com/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()

$Posting = $IE.document.fixrates.posting

If $Posting
? "Posting is real, value is " +$Posting.Value
? @error @serror
Endif

$FixRates = $IE.document.fixrates

If $FixRates
? "FixRates is real"
Endif

The results of the added line are:

-2147352570 Unknown name

Top
#105549 - 2003-10-25 02:18 AM Re: Is it possible to update a web page with a KiXtart script?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hmmm, brainstorm, what happens if you synchronize (or serialize) the document after the first submit, try this:

code:
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()

; Add this second synchro ...

While $IE.Busy and $IE.ReadyState <> 4 and @ERROR = 0 Loop

$Posting = $IE.document.fixrates.posting

; rest of code ...

-Shawn

Top
#105550 - 2003-10-25 02:25 AM Re: Is it possible to update a web page with a KiXtart script?
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Same results

Whats puzzling is that if,

-2147352570 Unknown name

is true, then why does the statment run in the first place?

Top
#105551 - 2003-10-25 02:31 AM Re: Is it possible to update a web page with a KiXtart script?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Can you email me a copy of the "view source" for this second page ?
Top
#105552 - 2003-10-25 02:35 AM Re: Is it possible to update a web page with a KiXtart script?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
oh yeah, and add this extra synchro just to be safe, right after the last synchro you added.

while $ie.document.readystate <> "complete" and @error = 0 loop

[ 25. October 2003, 02:35: Message edited by: Shawn ]

Top
#105553 - 2003-10-25 03:12 AM Re: Is it possible to update a web page with a KiXtart script?
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
Check your inbox for the source code

I added the second sync and got the same results

Top
#105554 - 2003-10-25 03:39 AM Re: Is it possible to update a web page with a KiXtart script?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ok, try this:

1) View the source for second page and save the page to a file called "c:\fixrate.htm" (whatever) ...

2) Runthe following script ...

Break On

$URL = "file://c:\fixrate.htm" ; --- change this to whatever

$IE = CreateObject("InternetExplorer.Application")

$IE.Visible = 1

$IE.Navigate($URL)

While $IE.Busy and $IE.ReadyState <> 4 and @ERROR = 0 Loop
While $ie.document.readystate <> "complete" and @error = 0 loop

$IE.document.fixrates.posting.value = 1

?"value=" $IE.document.fixrates.posting.value

$IE.document.fixrates.submit()

This demonstrates a couple of things - that the objects once they are loaded are resolving correctly - plus the submit is working correctly ... i think its the transition from one page to the next that is gumming the works ... after trying, can you send me source for the first page as well ?

-Shawn

Top
#105555 - 2003-10-25 06:37 AM Re: Is it possible to update a web page with a KiXtart script?
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
quote:
after trying, can you send me source for the first page as well ?

That source code is posted on page one of this posting.

Top
#105556 - 2003-10-25 06:53 AM Re: Is it possible to update a web page with a KiXtart script?
jacks73 Offline
Getting the hang of it

Registered: 2003-04-23
Posts: 58
The last test you sent yields:
value=1

Also, I got the first testing script to run properly. It gave me:

Posting is real, value is 0
FixRates is real

Top
Page 3 of 3 <123


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

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.08 seconds in which 0.043 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