Wrap up the last part of your code in a loop that will repeat it until web site responds.
You may want to add secondary timeout, otherwise your program will look like it's frozen when web site doesn't answer for a long time.
>
>I use this structure to track mail post objects, so I scan the reembolso.dbf table to get the numbers "obj_num"
> and test them over the site.
>
>as below:
>
>select reembolso...
>
>SCAN
>
>lcUrl = "
http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=" + obj_num
>
>oIE.navigate(lcUrl)
>
>
>...endscan
>
>(the full code is on the bottom)
>
>
>The software waits until the page is loaded and the returns page contents.
>
>It works fine when site is not busy.
>
>But sometimes the site is too busy and the SCAN never rolls the table.
>
>In such situations, I realized that if I click the address manually the page loads, after several attempts.
>
>I would like to modify the software, so as not wait for the correct page, but insist on the same url,
>until the page result is positive.
>
>for exemple:
>
> if result page contains "could not found" or something like that &&
> navigate again
> else
> endif
>
>I tried to modify the struct by myself but not succeed
>
>
>Thanks
>
>Moises
>
>
>
>
>
>
>SELECT REEMBOLSO
>
> SCAN for reembolso.retirou = .F. .AND. reembolso.dev = .F. .AND. reembolso.pg = .F. AND reembolso.old = .F. .and. DATE() - reembolso.date > 1
>
>PUBLIC lcInnerText
>
>oIE = CreateObject("InternetExplorer.Application")
>#DEFINE READYSTATE_COMPLETE 4
>#DEFINE MAX_TIME 30
>
>local lcInnerText
>local lcIPAdd
>local lnStartedAt
>local lnWaiting
>local lcRetVal
>
>STORE ALLTRIM(Reg_tipo) + ALLTRIM (REG) + "BR" to obj_num
>
>
DO WHILE .T.
>
>lnStarted = SECONDS()
>
>lcUrl = "http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=" + obj_num
>
>
>oIE.navigate(lcUrl)
>
>do while oIE.Readystate <> READYSTATE_COMPLETE or lnWaiting >= MAX_TIME
> lnWaiting = Seconds() - lnStarted
>enddo
>
>if lnWaiting < MAX_TIME
> lcInnerText = oIE.Document.Body.InnerText
>
>
>
>else
LOOP
>
> *lcInnerText = "?????"
>
>endif
>
ENDDO
>
>
--sb--