Joe Yoder wrote on 2014-02-17: 
>  I have gone through some HTML tutorials and now have a very simple HTML
>  file that when open in a browser will select one of the four paragraphs
in
>  the document and write it to the screen.  I also have a simple VFP
program
>  that loads an instance of IE and loads the same HTML file.  That program
>  then reports how many paragraphs are in the file but I have not been able
>  to get it to let me pick a single paragraph for output.  I am fairly
>  confident that what I want to do is possible but I have never gotten past
>  that line without an error.
>  
>  Any help will be greatly appreciated! - Joe
>  

<snip>

>  * Display the inner HTML of the third paragraph
>    ? loIE.document.getElementsByTagName("p")[2].innerHTML
>    
>    loie.Quit
>    RETURN
> 

Joe,

VFP is not able to use the collection returned from a method like you have
here. You will need to use the Item() collection.
    laElements = loIE.document.getElementsByTagName("p").Item(3).innerHTML

However, in my testing on Windows 7 SP 1 with Internet Explorer 11, the
loIE.Documents is not an object. I get this error when running: 
     Member DOCUMENT does not evaluate to an object.
It actually happens above the edited code.

Here's my solution:
   LOCAL oForm, loIE
   oForm = CREATEOBJECT("ieform")
   oForm.RequestNavigate(Full path to te HTML file)
   loIE = oForm.oIE
   * Display the number of paragraphs in the document
     ? loIE.document.getElementsByTagName("p").length, 'Paragraphs found'

   * Display the inner HTML of the third paragraph
     ?loIE.document.getElementsByTagName("p").Item(2).innerHTML


   DEFINE CLASS ieform as Form 

   allowoutput = .F.

   ADD OBJECT oIE as oleIE

   PROCEDURE RequestNavigate
      LPARAMETERS tcURL

      THISFORM.oIe.Navigate2(tcUrl)

      *-- Force the changes to oIE to be updated
      DOEVENTS FORCE 
      *-- Wait for the updates to complete
      DO WHILE THISFORM.oIE.Busy OR TYPE("THISFORM.oIE.Document.Body") <>
"O"
         DOEVENTS 
         =INKEY(.1)
      ENDDO 
   ENDPROC 

   ENDDEFINE 

   DEFINE CLASS oleIE as olecontrol

   *-- This is reports as IE 7
   oleclass = "Shell.Explorer.2"

   PROCEDURE init
      this.width = this.parent.width
      this.height = this.parent.height
   ENDPROC 

   ENDDEFINE

Tracy Pearson
PowerChurch Software


_______________________________________________
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