I have an OLE browser control and I want to do two Navigate in a row. But it seems the second one kills the first one.
In case you wonder why somebody would do two Navigate in a row - here are examples of what I want to achieve:
Example 1:
/* clear browser and write new content with JavaScript */
URL =Drive() : "\html\blank.htm"
Stat=Send_Message( @Window : ".OLE", "Navigate", URL )
URL =javascript:document.write("Some text ")'
Stat=Send_Message( @Window : ".OLE", "Navigate", URL )
Example 2:
/* write with JavaScript a piece at a time */
/* (there's a limit to how much can be written at once) */
URL =javascript:document.write("Some text ")'
Stat=Send_Message( @Window : ".OLE", "Navigate", URL )
URL =javascript:document.write("More text ")'
Stat=Send_Message( @Window : ".OLE", "Navigate", URL )
I can get these examples to work if I split them over two button CLICK events, with one Navigate in each. That might be a clue. Putting a delay() between them doesn't help. It's like the two messages are not processed until the current event finishes. And then the second one has taken out the first one or something.
Please help.
- Oystein -
More info:
- OI 4.1.2.
- Problem occurs with other messages than Navigate (GoHome).
- Problem also occurs when the two messages are different (GoHome + Navigate).
- Haven't tried other OLE controls.
Please help.
- Oystein -
Revelation,
Any comments or suggestions?
- Oystein -
Oystein:
You can change QualifyEvent to get the OLE events to run asynchronously
Then you loop with yield() and keep looking at the 'ReadyState' property
I think.
BTW, what did you do to piss off Osama?
Bob
World Leaders in all things RevSoft
Bob,
You can change QualifyEvent to get the OLE events to run asynchronously
Thanks. Found it in the docs. Will try on Monday.
Then you loop with yield() and keep looking at the 'ReadyState' property
OK.
I think.
OK.
![]()
BTW, what did you do to piss off Osama?
- Send fighter planes to Afghanistan?
- Expel suspected terrorist Mullah Krekar?
- Show too many American series on TV?
- Oystein -
Bob,
I can't get it to work. Would you mind having a look at what I've done?
My browser OLE control is called "OLE". Here's what I do to get the OLE events to fire immediately:
declare function Send_MessageEventName=ALL_OLES"Qualified=1* =Synchronous flag.* 0=event is posted to the Windows message queue* to be processed at a later time.* 1=event is fired immediatelyQualified=1ret=Send_Message( @Window : ".OLE", "QUALIFY_EVENT", EventName, Qualified )Is this correct?
My next question is about that "ReadyState" property. Which value should I look for? I've done some experiments where I first send a "Navigate" message to the control, then do a loop where I call Yield() and check for ReadyState. Here are some typical sequences of ReadyState values:
1 1 3 3 3 3 3 3 4 4 4 4 4 4 4 4 … 4 4 4 …
1 1 1 1 1 1 1 1 1 1 1 1 1 3 4 4 4 4 4 4 4 … 4 4 4 …
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 … 4 4 4 …
From these results I guess that 4 means ready. But I have no luck with the following code:
$insert Logicaldeclare function Get_Propertydeclare function Set_Propertydeclare function Send_Messagedeclare subroutine YieldURL =Drive() : "\html\blank.htm"Stat=Send_Message( @Window : ".OLE", "Navigate", URL )Ready=0Cnt=0loopwhile Ready 4Yield()Ready=Get_Property( @Window : ".OLE", "OLE.ReadyState" )Cnt += 1if Cnt ] 10000 then* something must have gone wrongdebugendrepeatURL =javascript:document.write("blah [b]blah[/b] blah")'Stat=Send_Message( @Window : ".OLE", "Navigate", URL )Still only the last of the two messages works.
- Oystein -
Bob,
Sorry. Somehow my code had lost that
Qualified=0line.
Thanks!
- Oystein -