>********************************************************************** > >SELECT reembolso > STORE 0 TO objEntregues > > > SCAN for reembolso.retirou = .F. .AND. reembolso.dev = .F. .AND. reembolso.pg = .F. > >PUBLIC lcInnerText > >oIE = CreateObject("InternetExplorer.Application") >#DEFINE READYSTATE_COMPLETE 4 >#DEFINE MAX_TIME 30 > >local lcInnerText && Text of the webpage >local lcIPAdd && IP Address as a string >local lnStartedAt && Seconds when started loading >local lnWaiting && Seconds waiting for the document to load >local lcRetVal && Return Value > > > >STORE ALLTRIM(Reg_tipo) + ALLTRIM (REG) + "BR" to obj_num > > >lnStarted = SECONDS() > >lcUrl = "http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=" + obj_num >*lcUrl = INPUTBOX("Digite o endereço","Obter conteúdo em texto de uma página web",lcUrl,15000) > >oIE.Visible = .T. >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 > lcInnerText="???????????????"+chr(13)+'Timeout' >endif > >*=strtofile(lcInnerText, obj_num + ".txt") &&text to file >locate1 = 'ENTREGUE' $ UPPER(lcInnerText) > >IF locate1 = .T. > replace reembolso.retirou WITH .T. > objEntregues = objEntregues + 1 > ENDIF > > >lcUrl.close > > > > > >RELEASE lcInnerText > > >*RELEASE READYSTATE_COMPLETE >*RELEASE MAX_TIME > >release lcInnerText && Text of the webpage >release lcIPAdd && IP Address as a string >release lnStartedAt && Seconds when started loading >release lnWaiting && Seconds waiting for the document to load >release lcRetVal && Return Value > > > > ENDSCAN > > > = MESSAGEBOX (STR(objEntregues)) > >*************************************************************************