And thus I say for the second time in 24 hours: Eureka!

For anyone else coming down this path, here's how to shutdown, reboot or logoff 
Windows, each with the option to force the action. In other words, you can 
force Windows to reboot even if its asking if you want to save a document. 

<code>

nLogOff=0 
nReboot=2 
nForceLogOff=4 
nForceReboot=6 
nPowerDown=8 
nForcePowerDown=12

import wmi
wmi.WMI(privileges=["Shutdown"]).Win32_OperatingSystem()[0].Win32Shutdown 
(Flags=nForceReboot)

</code>

As is probably pretty obvious, change the "Flags" parameter to whatever you 
want from the list of options above.

On the off chance anyone's curious what my questions have been about, its a 
sleep timer to shutdown winamp, itunes, vlc, etc., or shutdown windows after a 
period of time. So now I can be a total slacker and fall asleep to a DVD and 
not have the menu music playing all night long.

http://gizmoware.net/sleeper







      
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to