Python and Windows Scripting Host

Syver Enstad syver at osiris.no
Wed Aug 9 08:23:22 EDT 2000


>>particularly as the WSH object model is
> > available directly from Python without WSH at all!
>
> So how do we access them? Can you provide an equivalent to
> the WSH program posted - assuming events were supported!

Here is an equivalent in standard python with Win32com extensions for Win32.
But I don't know how to do the events in python yet.

import win32com
Ie = win32com.client.Dispatch("InternetExplorer.Application")
Ie.Visible = 1;
Ie.Navigate("http://www.python.org")

while Ie.Visible:
    pass


def Browser_DownloadBegin():
    print "Download begin"

def Browser_DownloadComplete():
    print "Download complete"

def Browser_DocumentComplete(disp, url):
    print "Document complete at %s" % url
    doc = Ie.Document
    print doc.Title







More information about the Python-list mailing list