IF VARTYPE(loBod) = "X" RETURN ENDIFtry
IF VARTYPE(loBod) <> "X" the rest of the code endif>I've tried loading a blank page, but it did not work. In case it would give you an idea, I join the GetArticle functions where the page is saved, then released. I also join, at the bottom, the Timer function and the Navigate function it calls. That is pretty much all that is used in the application!
>LOCAL loDoc, lcPref, loBod, lnLines >LOCAL llWriteOut, lcOutPut, lnCnt, lcLine, lcCateg >LOCAL lcInfo, lcDepart, lcDestin > >lcInfo = " " >lcDepart = " " >lcDestin = " " > >WITH ThisForm.pgfkbase.page2.oExplorer > *** Get the current document into a local variable > loDoc = .Document > > *** Now get a reference to the document body object > loBod = loDoc.body > > IF VARTYPE(loBod) = "X" > RETURN > ENDIF > > *** Get the text from the body into an array for parsing > lnLines = ALINES( laText, loBod.InnerText ) > *** And initialise a couple of variables > lcOutPut = "" > > *** The following block of code parses the entire array, but we only want to > *** write certain lines out to the final output. The llWriteOut Flag is used > *** to control when we start writing data out. > > FOR lnCnt = 1 TO lnLines > *** Get the line, preserve leading spaces > lcLine = ALLTRIM( laText[ lnCnt ] ) > > *** If we get this far, we must want this line of text > *** So just add it to the output string > *** Note that ALINES() removes CRLF, so we must add them back > > IF "Total Travel Estimate:" $ lcLine > lcInfo = lcLine > ENDIF > > *** If we get here, we must have started writing data out, so the > *** Question now is, have we reached the end? > IF !EMPTY(lcInfo) > *** Yes, we have reached the end of the text we want, so get out > EXIT > ENDIF > > NEXT > >ENDWITH > >*** And Write the data out if we don't already have this Q Number >IF !EMPTY(lcInfo) > lcInfo = LEFT(lcInfo,ATC("miles",lcInfo)-1) > lcInfo = ALLTRIM(SUBSTR(lcInfo,ATC("Total Estimated Time:",lcInfo)+21,100)) > INSERT INTO kbase VALUES (ADRESSE.depart, ADRESSE.Destin, lcInfo ) >ENDIF > >RELEASE ALL > >RETURN >>
>thisform.getarticle >SELECT adresse >IF RECNO() = RECCOUNT() > thisform.Release >ENDIF >REPLACE fait WITH .t. > >SKIP >DO WHILE fait = .t. OR cantfind = .t. > SKIP >ENDDO > >thisform.navigate(adresse.adresse) >thisform.refreshpage > >this.Reset() >>
>LPARAMETERS tcURL >*** If we got a URL, go to it >IF NOT EMPTY( tcURL ) > ThisForm.pgfkbase.page2.oExplorer.Navigate( tcURL ) > ***If the page did not open properly, we open it with the URL from the table directly > IF ALLTRIM(ThisForm.pgfkbase.page2.oExplorer.locationURL) # ALLTRIM(adresse.adresse) > ThisForm.pgfkbase.page2.oExplorer.Navigate( adresse.adresse ) > ENDIF > WAIT NOWAIT TIMEOUT 3.5 >ENDIF >RETURN >