Browser State 
Author Message
 Browser State

I am using Shell.Run to launch a series of URL's in IE.  Currently i am
using a hard-coded sleep value to wait for the URL to execute so I can then
close the window using sendkeys.  Is there any way to check the State of the
Browser window from WSH?  I have tried adding a do while
browser.readystate<>4, but that doesn't seem to work.

Any Ideas?

Thanks in Advance,
    -a12vman



Mon, 27 Sep 2004 21:49:15 GMT  
 Browser State
Not if you want to use Shell.Run.  You really, really, really want to use
browser automation instead.  Watch this:

set oIE = WScript.CreateObject("InternetExplorer.Application")
oIE.navigate "http://www.yahoo.com"
Do Until oIE.ReadyState = 4:WScript.Sleep 10 : Loop
oIE.visible = true
sData = oIE.document.body.InnerText

'just so you can see it...
MsgBox " Click me when you're ready to close IE."
oIE.Quit

wscript.echo sData


Quote:
> I am using Shell.Run to launch a series of URL's in IE.  Currently i am
> using a hard-coded sleep value to wait for the URL to execute so I can then
> close the window using sendkeys.  Is there any way to check the State of the
> Browser window from WSH?  I have tried adding a do while
> browser.readystate<>4, but that doesn't seem to work.

> Any Ideas?

> Thanks in Advance,
>     -a12vman



Mon, 27 Sep 2004 22:14:33 GMT  
 Browser State
hi a12vman,

In addition to Alex's suggestion, you may (if you are adventuresome) be able
to automate the entire process via automation.

Here's the thought.  After loading up the page, then add some scripting to
it, using something like "InsertHtml".  You didn't say exactly what you
meant by "waiting for the URL to execute", but the idea would be to latch on
to some element or event within the webpage which would be indicative of the
execution being complete.  An ideal situation might be a situation where the
webpage produced a text message within some specific set of tags, such as
"I'm complete now" or "your order has been processed".  So you could look
either for an event (such as a click event) or use a timer to periodically
check for some feature (like text) which would indicate completion.

You then have to build a connection back to your script.  This is normally
done by using "GetRef" to get a reference to a subroutine in your script,
and then inserting the reference inside the script you planted in the
webpage.  Something like this:

    oIE.Document.All.CompleteButton.OnClick = GetRef("CallMeBackWhenDone")

I'll concede that this sounds a little goofy, and I confess that I've never
tried it.  But I do think that it is do-able, and worth investigating.  It
all depends on how much effort you wish to devote to automating this.

cheers, jw


Quote:
> I am using Shell.Run to launch a series of URL's in IE.  Currently i am
> using a hard-coded sleep value to wait for the URL to execute so I can
then
> close the window using sendkeys.  Is there any way to check the State of
the
> Browser window from WSH?  I have tried adding a do while
> browser.readystate<>4, but that doesn't seem to work.

> Any Ideas?

> Thanks in Advance,
>     -a12vman



Tue, 28 Sep 2004 00:40:35 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. browser to browser

2. Wait state

3. detecting user's onine state

4. detecting system modal wait state in script ?

5. Printer state between pages

6. state between pages

7. State Diagrams

8. USA and state border outlines wanted

9. Play State Changes in Media Player

10. examples of ScriptControl.State = Connected ?

11. Bringing a window up in a Maximized State

12. Detect current state

 

 
Powered by phpBB® Forum Software