Sergey,
Unless browser control removed and added we stay in a loop
DO WHILE .ReadyState # 4
WAIT WINDOW "" TIMEOUT .01
ENDDO
redardless either the same refreshed file or different file is given as a parameter for navigate2. It starts to happen when we call navigate2 for the second time in our main loop ( SCAN ... ENDSCAN ) . There is no such a problem when we have a form and "READ EVENTS" and browser control is refreshed let's say on button click from the refreshed file with the same name.
Michael
>Hi Michel,
>
>Can you explain what problem exactly do you have when you load the same file second time?
>>When browser control placed onto form visually and this form runs, issuing navigate method even for the same local file ( assuming it was refreshed with the new content ) refreshes browser control without any problem. However, in a code below removing and adding subclassed browser control is required , otherwise we are in a loop for readystate. I am aware of CreateObject( "internetexplorer.application" ) which works properly with navigate method without need to instantiate it each time, but I need an alternative way for someone. My main concern is that the method below is very slow.
>>
>>Thanks
>>Michael
>>
>>
>>oparser = CREATEOBJECT('HTMLParser' )
>>SCAN
>> ltext = oparser.getInnerText(htmlfield )
>>ENDSCAN
>>
>>
>>DEFINE CLASS HTMLParser AS FORM
>>
>> FUNCTION getInnerText
>> LPARAMETERS tcHTML
>> ltext = ''
>> TRY
>> lcTemp = ADDBS(SYS(5)+CURDIR())+ SYS(2015)+ '.htm'
>> STRTOFILE(tcHTML,lcTemp ,0)
>>
>>* required to avoid to achieve readystate
>>
>> IF VARTYPE(THIS.oie) = 'O'
>> THIS.REMOVEOBJECT( "oIE" )
>> ENDIF
>> THIS.ADDOBJECT( "oIE" , "fbrowser" )
>>***
>> WITH THIS.oie
>> .Navigate2(lcTemp)
>> DO WHILE .ReadyState # 4
>> WAIT WINDOW "" TIMEOUT .01
>> ENDDO
>> ENDWITH
>> ltext = THIS.oie.DOCUMENT.body.innertext
>> CATCH TO loexception
>> ltext = ''
>> ENDTRY
>> RETURN ltext
>> ENDFUNC
>>ENDDEFINE
>>