I usually step through three iterations:

Do while oie.readystate<>4
Enddo
Do while oie.document.readystate<>'complete'
Enddo
Do while oie.busy()
Enddo

That's off the top of my head, so I may have 4 and complete reversed....

John Harvey


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Bill Anderson
Sent: Wednesday, July 15, 2009 1:20 PM
To: ProFox Email List
Subject: Re: VFP controlling IE; works in CW; DW, not in program

>
>  Tue, 14 Jul 2009 15:00:51 -0700
>   Bill Anderson <[email protected]> wrote:
> >The following is a cut down version of automating Google searches.
> >
> >goIE = CREATEOBJECT([InternetExplorer.Application])
> >goIE.Navigate2([<<a href="http://www.google.com])"  target="top"
> >>>http://www.google.com])<</a>>
> >WaitForReadyState(4, 5000)
> >loInputElements = goIE.Document.GetElementsByTagName([Input])
> >loGoogleSearchInput = loInputElements.Item(1) && search field
> >loGoogleSearchButton = loInputElements.Item(2)
> >loGoogleSearchInput.Value  = [TEST]
> >loGoogleSearchButton.Click()
> >WaitForReadyState(4, 5000)
> >loNodes = goIE.Document.GetElementsByTagName([A])
> >li = 0
> >
> >FOR EACH loNode IN loNodes
> >
> >  li = li + 1
> >
> >  IF loNode.ClassName = [l]
> >
> >    ?li
> >    ?loNode.InnerHTML
> >    ?loNode.ToString
> >
> >  ENDIF
> >
> >ENDFOR
> >
> >If I run this at the command window (putting the FOR loop in a temp
> program
> >and run it) I get what's expected. If I run it step by step in the
> debugger
> >I get what's expected.
> >
> >But if I run it as a program, I get no display.
> >
> >Suspending the program and trying this at the command window
> >
> >xxx = lonodes.item[1]
> >
> >Produces a "OLE error code 0x80070005: Access is denied." error using
IE8.
> >IE6 doesn't provide any error, just doesn't seem to work. Using XP SP3.
> >
> >I assume this is some sort of IE security setting but I wouldn't know
> where
> >to turn. Again, this works at the command window and the debugging window
> if
> >I step through the code...but not running it.
> >
> >Thanks for any help,
> >
> >Bill Anderson
>

You guys put me on the right track. The key was the document also has a
ReadyState property that needs testing.

Thanks!

Bill


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/01b701ca0585$b21a0780$164e16...@[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to