Mike,
The one thing to be careful of doing it my way is that the method uses the full 
IE DOM (Document Object Model) which isn't fully available in earlier versions 
of Internet Explorer. I think it was only IE8 and onwards when M$ exposed the 
FULL DOM model but I can't check here as we only use IE9.

Dave


-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Mike Copeland
Sent: 16 November 2012 09:20
To: [email protected]
Subject: Re: VFP searching a web form

Thanks Dave. You've confirmed that I'm on the right track...I think I'm going 
to drop my reference to the "object" in the object reference.  
(Hmm, that's redundantly redundant!)

Mike


-------- Original Message --------
Subject: Re: VFP searching a web form
From: Dave Crozier <[email protected]>
To: [email protected]
Date: 11/16/2012 1:26 AM

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
**********************

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
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/[email protected]
** 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