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
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to