Mike, this is what I use to scrape pages. Assumes Windows 7 and IE 9

Dave

****************
* Start Program
*
#define CR CHR(13)

clear

oIE = createobject( "internetexplorer.application" )

oIE.Visible = .t.
oIE.Silent = .F.

* oIE.Width = Sysmetric(1)
* oIE.Height = Sysmetric(2)
* oIE.Left=0
* oIE.Top=0

oIE.Navigate( "http://www.microsoft.com"; )
WaitForIE()


*!*     for I=1 to 20000
*!*       doevents
*!*     endfor

loDoc = oIE.Document && get the Document object
*!*     oRange = loDoc.body.createTextRange()
*!*     if oRange.FindText("Business", 1000000)
*!*             oRange.Select()
*!*     endif

loForm = loDoc.forms(0) && get the first form object
for i = 0 to loForm.Length-1
  ? i, loForm.Item(i).Name, loForm.Item(i).Value
endfor

* Show the names of the forms:
x = "Forms"+Chr(13) ;
                +"====="+Chr(13)
For lnForm = 0 to oIE.Document.forms.length - 1
        x = x + TRANSFORM(lnForm) + ": " + 
TRANSFORM(oIE.Document.forms(lnForm).name)
EndFor
x = x + CR

* Look at all of the objects.
* all(0) represents everything,
* 1-N are contained objects some of which are containers themselves,
* so the same thing may apear in different .all(x)'s
x = x + "All Objects:"+Chr(13)+"============"+Chr(13)
For lnObj = 0 to oIE.Document.all.length - 1
        loObj = oIE.Document.all( lnObj )
        x = x + TRANSFORM(lnObj) + ": " + TRANSFORM(Substr(loObj.innerhtml, 1, 
20))
        x = x + TRANSFORM(loObj.TagName) + ": " + TRANSFORM(loObj.innertext)
        
        X=X+Chr(13)
endfor

STRTOFILE(loform.InnerHTML, "WebResult.txt")
MODIFY FILE WebResult.txt NOWAIT

return

PROCEDURE WaitForIE
  DO WHILE oIE.Busy() OR oIE.ReadyState <> 4
    DOEVENTS
  ENDDO
endproc
*
* End Program
**********************

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/bd031ecabf2b60499200aab3dbb4a999012b2c5...@ex-a-fpl.fpl.LOCAL
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to