are you missing the "ie = w"

in the first example?

________________________________________
From: [email protected] [[email protected]] 
On Behalf Of [email protected] 
[[email protected]]
Sent: Wednesday, July 28, 2010 4:09 PM
To: [email protected]
Subject: Users Digest, Vol 72, Issue 74

Send Users mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Users digest..."


Today's Topics:

   1. Shell.Application.Windows (Lacko Roman)


----------------------------------------------------------------------

Message: 1
Date: Wed, 28 Jul 2010 17:21:15 +0200
From: Lacko Roman <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [IronPython] Shell.Application.Windows
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Hi,

I have problem with following code, where call to [doc.title] failes:

# GET ALL INTERNET EXPLORER WINDOWS
app = 
System.Activator.CreateInstance(System.Type.GetTypeFromProgID("Shell.Application"))
for w in app.Windows():
    try:
        print w.Type()
        # CHECK IF THIS WINDOW HOLDS HTML
        if (w.Type() == "HTML Document"):
            doc = ie.document
            # THIS WILL FAIL WITH "object <doc> has no property <title>"
            print doc.title
            break
    except Exception, e:
        print e

All I want is to get specific internet explorer window and get some info from 
the document

This code is working in Cpython with win32com:

app = win32com.client.Dispatch("Shell.Application")
for w in app.Windows():
    try:
        print w.Type
        if (w.Type == "HTML Document"):
            ie = w
            doc = ie.document
            print doc.title
            break
    except Exception, e:
        print e

Thanks in advance

-Roman


------------------------------

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


End of Users Digest, Vol 72, Issue 74
*************************************
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to