[python-win32] turning monitors off from Python?

2008-12-04 Thread Alec Bennett
I'm trying to turn a monitor off from a Python script. I can do this using the program "wizmo", so its possible from Windows. I found this script which describes a method using SendMessage: http://fci-h.blogspot.com/2007/03/turn-off-your-monitor-via-code-c.html Translated to Python, here's what

Re: [python-win32] turning monitors off from Python?

2008-12-04 Thread Tim Golden
Alec Bennett wrote: I'm trying to turn a monitor off from a Python script. I can do this using the program "wizmo", so its possible from Windows. I found this script which describes a method using SendMessage: http://fci-h.blogspot.com/2007/03/turn-off-your-monitor-via-code-c.html Translated

Re: [python-win32] turning monitors off from Python?

2008-12-04 Thread Alec Bennett
> The article you mention suggests using the desktop window > handle -- available via GetDesktopWindow (). You might try that? I have a feeling that was progress, but still no reaction on my monitors. Here's the code including the new clue: SC_MONITORPOWER = 0xF170 handle = win32gui.GetDesktopWi

Re: [python-win32] turning monitors off from Python?

2008-12-04 Thread Alec Bennett
Eureka! In case anyone else comes down this path, the trick is to use HWND_BROADCAST to send the message to all windows. So the code to turn off all monitors: SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2) According to the doc

Re: [python-win32] turning monitors off from Python?

2008-12-04 Thread Michel Claveau
Hi! Eureka! Thanks for your /fun/shared/ code-source. @-salutations -- Michel Claveau ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32

Re: [python-win32] Problem in accessing the Sender and Receiver addresses of an outlook mail

2008-12-04 Thread Tim Roberts
venu madhav wrote: > > I am using Exchange server and partial code is given below > message = inbox.Messages.Item(11) > objRecip = message.Recipients.Item(1) > typ = objRecip.AddressEntry.Type > print " the type of address " > print typ > > Its output is > **

[python-win32] rebooting windows from Python?

2008-12-04 Thread Alec Bennett
I'm wondering if there's some way to reboot or shutdown Windows from within Python? I can log out like this: win32api.ExitWindowsEx(4) And according to the documentation, I should be able to shutdown like this: win32api.ExitWindowsEx(2) But that returns the following error: 'A required priv

Re: [python-win32] rebooting windows from Python?

2008-12-04 Thread Tim Roberts
Alec Bennett wrote: > I'm wondering if there's some way to reboot or shutdown Windows from within > Python? > > I can log out like this: > > win32api.ExitWindowsEx(4) > > And according to the documentation, I should be able to shutdown like this: > > win32api.ExitWindowsEx(2) > > But that returns

Re: [python-win32] rebooting windows from Python?

2008-12-04 Thread Wesley Brooks
To restart I use: outFileObject = os.popen("shutdown -r -t 05", 'r') To shutdown swap -r for -s. This is the same as running the "shutdown -r -t 05" on the command prompt. The number is the delay and the outFileObject catches any messages that would be printed out to the command prompt window.

[python-win32] Walking the registry and creating reg files

2008-12-04 Thread Mike Driscoll
Hi, We're doing what amounts to a registry session audit here at work, so I need to walk a specific set of subfolders in our registry and get the contents thereof. The subfolders will vary from user to user. I found Tim Golden's excellent registry walking script on his website here: http://t

Re: [python-win32] Walking the registry and creating reg files

2008-12-04 Thread Tim Roberts
Mike Driscoll wrote: > > We're doing what amounts to a registry session audit here at work, so > I need to walk a specific set of subfolders in our registry and get > the contents thereof. The subfolders will vary from user to user. I > found Tim Golden's excellent registry walking script on his we

Re: [python-win32] Walking the registry and creating reg files

2008-12-04 Thread Alec Bennett
Reg files are just text files, so why not just create the text files yourself? Here's a reg file for example: REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Gizmoware\Whatever] "Name"="Yada" "Number"="something" --- On Thu, 12/4/08, Tim Roberts <[EMAIL PROTECTED]> wrote: > From: Tim Roberts <[EMAI

Re: [python-win32] Walking the registry and creating reg files

2008-12-04 Thread Tim Roberts
Alec Bennett wrote: > Reg files are just text files, so why not just create the text files yourself? > > Here's a reg file for example: > > REGEDIT4 > > [HKEY_LOCAL_MACHINE\SOFTWARE\Gizmoware\Whatever] > > "Name"="Yada" > "Number"="something" > Because Mike said he needed to extract sections fr