Python and Windows Scripting Host

Don Tuttle tuttledon at hotmail.com
Thu Mar 2 17:39:07 EST 2000


[Alan G.]
> Nope, WSH doesn't do any GUI stuff - its designed
> to replace BAT files agfter all!
>
???   Try running this script.

import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
rslt=shell.Popup("Would you like to run Notepad?", 0, "Python WSH Test!",
35)
if rslt == 6:
    shell.run("notepad")
else:
    shell.Popup("Maybe next time.", 4, "Bye!")


 Using Python to access WSH objects, like Mark Hammond suggested,  makes
alot more sense than using WSH as the controlling environment.  (providing
you not forced into a mixed environment like Gaetan has mentioned).
Although I still prefer WinBatch for Admin stuff.

Don








More information about the Python-list mailing list