Yuri
Tue May 25 17:24:32 CDT 2004
I think you are right - it was choking on error. It's working nice now.
Thx
"Cretu Lucian" <cretulucian@hotmail.com> wrote in message
news:OhlvKspQEHA.252@TK2MSFTNGP10.phx.gbl...
> I think the cause maybe the thing that i told you about in the previous
> message - that the code also is accessing the Explorer (which do not have
a
> HTML content) together with IE instances.
> This error message i think it appears when the code tries to access the
HTML
> code of an address which doesn't contain HTML.
>
> I run the VBScript from another interpretor, and i didn't handle the
errors,
> i simply tested if the .xx...Document.Body.InnerHTML successfully
returned
> a value. I think there is a way to detect if the ActiveX object has HTML
> content or not (i think i saw some VB example), but as i said i am a
> beginner in VBS, and this request even until now it was time consuming for
> me.
>
> You could check if i am right or not by closing all Eplorer windows when
> running the script, to see if the error still appears.
> Please let me also know of the result, because i already have a customer
> using this code.
>
> > Can you provide the finial code that you use?
> It's difficult to do that, because it's generated dynamically and loaded
> into a variable..
> I made up now an equivalent code:
>
> On error resume next
> Dim shell
> Dim e
> Set shell = CreateObject("Shell.Application")
> Set e=shell.windows()
> For i = 0 to e.Count-1
> s=""
> s=e.Item(i).document.body.innerhtml
> if (s<>"") then
> msgbox s
> end if
> next
>
>
> I am sure there is a better and more correct way to do what i wanted, but
> this works for me , and i don't have time to document some more. If you
> manage to make a better code, please share it with me is possible.
>
>
> Regards,
>
> Cretu Lucian
>
>
>
>
> > When I run it on different machines (I don't know what else makes them
> > different, but names) the script does not work, error in line 6 'Object
> does
> > not support this property or method: "Item(...).document.boody ... Code
> > 800A0186"
> >
> > Does it require a particular version of WSH?
> >
> > Can you provide the finial code that you use?
> >
> > =====
> >
> > Regards
> >
> > YuriW
> >
> >
> > "Cretu Lucian" <cretulucian@hotmail.com> wrote in message
> > news:ewEduAoQEHA.620@TK2MSFTNGP10.phx.gbl...
> > > A thing i forgot to mention on the previous messages : this code also
> > > parses the Explorer instances together with IE instances.
> > > I tested the code on 2 systems , and also the client said it's OK.
> > >
> > > Tell me please on which system doesn't work and what it does on the
> system
> > > where it doesn't work (any error message?).
> > >
> > >
> > > > You know what is interesting - it seems to work on one system and
does
> > not
> > > > work on another.
> > > > Any clues why?
> > > >
> > > > Thx!
> > > >
> > > >
> > > > "Cretu Lucian" <cretulucian@hotmail.com> wrote in message
> > > > news:uOtx9shQEHA.556@tk2msftngp13.phx.gbl...
> > > > >
> > > > > Yes, you can access all document elements using
e.Item(i).document
> > > > > property, but from what i understood this code cannot be run from
> > within
> > > a
> > > > > browser, only from another script interpretor. The code is not
> allowed
> > > to
> > > > > run from within IE due to security reasons.
> > > > >
> > > > > Here is a link to the document property help from MSDN and also a
> > quote
> > > > from
> > > > > MSDN:
> > > > >
> > > > >
> > > >
> > >
> >
>
http://msdn.microsoft.com/workshop/browser/webbrowser/reference/properties/document.asp
> > > > >
> > > >
> > >
> >
>
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/objects/webbrowser.asp
> > > > >
> > > > >
> > > > > Document Property
> > > > >
> > > >
> > >
> >
>
> --------------------------------------------------------------------------
> > > > --
> > > > > ----
> > > > >
> > > > > Retrieves the automation object of the active document, if any.
> > > > >
> > > > > Syntax
> > > > >
> > > > > [ oAutomation = ] object.DocumentPossible Values
> > > > >
> > > > > oAutomation Object that receives the automation object.
> > > > >
> > > > > The property is read-only. The property has no default value.
> > > > >
> > > > > Remarks
> > > > >
> > > > > When the active document is an HTML page, this property provides
> > > access
> > > > to
> > > > > the contents of the HTML Document Object Model (DOM).
Specifically,
> it
> > > > > returns an HTMLDocument object reference. The HTMLDocument object
is
> > > > > functionally equivalent to the HTML document object used in HTML
> page
> > > > > script. It supports all the properties and methods necessary to
> access
> > > the
> > > > > entire contents of the active HTML document.
> > > > >
> > > > >
> > > > >
> > > > > > Can I access all document elements using this method?
> > > > > > Do you have more examples?
> > > > > >
> > > > > > Thx
> > > > > >
> > > > > >
> > > > > > "Cretu Lucian" <cristi_teglas@hotmail.com> wrote in message
> > > > > > news:%23iz7ApJQEHA.1312@TK2MSFTNGP12.phx.gbl...
> > > > > > > Problem solved.
> > > > > > > Here is the piece of code in case somebody else would need it
:
> > > > > > >
> > > > > > > Dim shell
> > > > > > > Dim e
> > > > > > > Set shell = CreateObject("Shell.Application")
> > > > > > > Set e=shell.windows()
> > > > > > > For i = 0 to e.Count-1
> > > > > > > msgbox e.Item(i).document.body.innerhtml
> > > > > > > next
> > > > > > >
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > I am beginner in VBScript programming and i need a VBScript
> code
> > > > which
> > > > > > > > parses the IE instances in order to get their HTML content.
> > > > > > > > I know that i can get the HTML code from a Web Browser or
IE
> > > object
> > > > > > with
> > > > > > > > "IEObj.Document.Body.InnerHTML", but i don't know if i can
> > connect
> > > > to
> > > > > > > > existing IE instances in order to read the HTML code of the
> > > current
> > > > > > page.
> > > > > > > >
> > > > > > > > I appreciate any helpful information.
> > > > > > > >
> > > > > > > > Regards,
> > > > > > > >
> > > > > > > > Cretu Lucian
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>