Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OIE = CreateObject..
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
OIE = CreateObject..
Miscellaneous
Thread ID:
01493586
Message ID:
01493586
Views:
127
Hi

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 && 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
                     
 
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 = "?????"
   
endif 

*ENDDO
Next
Reply
Map
View

Click here to load this message in the networking platform