Python and Windows Scripting Host

Mark Hammond mhammond at skippinet.com.au
Thu Mar 2 02:12:50 EST 2000


"John Nielsen" <nielsenjf at my-deja.com> wrote in message
news:89kabt$f6r$1 at nnrp1.deja.com...

> Maybe there's something I am missing. But, it doesn't seem that
python
> has much to gain from WSH.

Actually, it does have a little to gain - it's objects!

Eg, your sample code:

> ' VB Script
> Set WShShell = WScript.CreateObject("WScript.Shell")

Demonstrates that almost all WSH functionality is exposed via
"WScript" COM objects.  These are just ordinary COM objects, so from
Python you can say:

>>> import win32com.client
>>> shell = win32com.client.Dispatch("WScript.Shell")

This means Python can do absolutely everything WSH can do :-)

Mark.






More information about the Python-list mailing list