Python and Windows Scripting Host

Alex Martelli alex at magenta.com
Wed Aug 9 09:22:26 EDT 2000


"Syver Enstad" <syver at osiris.no> wrote in message
news:O0ck5.4457$aK5.74331 at news1.online.no...
> >>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.

Not trivial.  You have to have run genpy on the relevant tbl; then
you can either DispatchWithEvents (then the object whose events
you're catching, and the code you're catching them with, get
mixed-in into just one object... hmmm), or getevents and derive
your class from that.  The former is advised as it takes care for
you to avoid possible reference-loops via some proxy trickery.

The object methods that will receive the events will always be
named OnDownloadBegin, etc, etc, with either choice.


Alex






More information about the Python-list mailing list