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
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
> 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
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
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
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
> **
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
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
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.
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
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
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
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
13 matches
Mail list logo