Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

screensaver

1 view
Skip to first unread message

Michele Simionato

unread,
Nov 6, 2003, 10:04:07 AM11/6/03
to
I would like to disable/enable the screensaver on a Win98 box with a
Python script. Any suggestion? Thanks,

Michele

SBru...@trisystems.co.uk

unread,
Nov 6, 2003, 10:20:00 AM11/6/03
to pytho...@python.org, mi...@pitt.edu
> From: mi...@pitt.edu [SMTP:mi...@pitt.edu]

> I would like to disable/enable the screensaver on a Win98 box with a
> Python script. Any suggestion? Thanks,

Not exactly what you want, but it might set you in the right direction...

http://www.brunningonline.net/simon/blog/archives/000562.html

Cheers,
Simon Brunning,
http://www.brunningonline.net/simon/blog/
--LongSig

-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.

Andy Jewell

unread,
Nov 11, 2003, 1:07:24 PM11/11/03
to pytho...@python.org

Michele,

there's probably a switch in the registy... check the MS site for details.
i'm sure you know how to use the _winreg module ;-)

good luck

ps. sorry for the previous blank e-mail - twitchy mouse-finger ;-)

-andyj

Michele Simionato

unread,
Nov 12, 2003, 2:51:39 AM11/12/03
to
Andy Jewell <an...@wild-flower.co.uk> wrote in message news:<mailman.637.1068574...@python.org>...

> On Thursday 06 Nov 2003 3:04 pm, Michele Simionato wrote:
> > I would like to disable/enable the screensaver on a Win98 box with a
> > Python script. Any suggestion? Thanks,
> >
> > Michele
>
> Michele,
>
> there's probably a switch in the registy... check the MS site for details
> .
> i'm sure you know how to use the winreg module ;-)
>
> good luck

Unfortunately, I am not a Windows person. Actually I mostly use
Windows to
watch DVD's, so I would like to stop the screensaver before watching
the movie and restart it afterward, in an automatic fashion. I looked
at Simon Brunning's script, the meat of it is in the following two
lines:

# set user section of registry.
keyHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER,
'Control Panel\Desktop', 0, win32con.KEY_WRITE)
win32api.RegSetValueEx(keyHandle, 'SCRNSAVE.EXE', 0,
win32con.REG_SZ, saverInstalled)

I have no idea of what it is happening here; I guess the script is
installing
'SCRNSAVE.EXE' whereas I would like to remove it :-(


Michele

Thomas Heller

unread,
Nov 12, 2003, 3:32:58 AM11/12/03
to
mi...@pitt.edu (Michele Simionato) writes:

A google search for 'disable screensaver windows' turns up VB code,
which easily translates into this Python code:

-----
import ctypes
SPI_SETSCREENSAVEACTIVE = 17

def StartScreenSaver(on):
ctypes.windll.user32.SystemParametersInfoA(
SPI_SETSCREENSAVEACTIVE, on, None, 0)

StartScreenSaver(1)
-----

Unfortunately, it doesn't seem to work (for me, on XP. At least it has
no visible effect).

Thomas

Michael Geary

unread,
Nov 12, 2003, 4:43:31 AM11/12/03
to
Thomas Heller:

> A google search for 'disable screensaver windows' turns up VB code,
> which easily translates into this Python code:
>
> -----
> import ctypes
> SPI_SETSCREENSAVEACTIVE = 17
>
> def StartScreenSaver(on):
> ctypes.windll.user32.SystemParametersInfoA(
> SPI_SETSCREENSAVEACTIVE, on, None, 0)
>
> StartScreenSaver(1)
> -----
>
> Unfortunately, it doesn't seem to work (for me, on XP. At least it has
> no visible effect).

Your StartScreenSaver() function should probably be called
EnableScreenSaver(). Call it with a 0 parameter to disable the screen saver,
or 1 to enable it.

The function won't have any immediate visible effect--it simply enables or
disables the screen saver, it doesn't start or stop it.

Try setting your screen saver timeout to one minute. Let the computer sit
for a minute to verify that the screen saver is working. Then call
EnableScreenSaver(0) to disable the screen saver, and let the computer sit
for a minute again to see if you've disabled it.

-Mike


Joe Francia

unread,
Nov 12, 2003, 10:17:35 AM11/12/03
to
Michele Simionato wrote:
> Andy Jewell <an...@wild-flower.co.uk> wrote in message news:<mailman.637.1068574...@python.org>...
>
>>On Thursday 06 Nov 2003 3:04 pm, Michele Simionato wrote:
>>
>>>I would like to disable/enable the screensaver on a Win98 box with a
>>>Python script. Any suggestion? Thanks,
>>>
>>> Michele
>>
>>Michele,
>>
>>there's probably a switch in the registy... check the MS site for details
>>.
>>i'm sure you know how to use the winreg module ;-)
>>
>>good luck
>
>
> Unfortunately, I am not a Windows person. Actually I mostly use
> Windows to
> watch DVD's, so I would like to stop the screensaver before watching
> the movie and restart it afterward, in an automatic fashion. I looked
<snip>

Perhaps the DVD software has an option to disable screen saver during
playback?

Peace,
Joe

Michele Simionato

unread,
Nov 13, 2003, 5:02:54 AM11/13/03
to
"Michael Geary" <Mi...@DeleteThis.Geary.com> wrote in message news:<vr40641...@corp.supernews.com>...

I have just installed ctypes and tried this solution. It works perfectly
well !;)
Thanks to everybody who helped here,

Michele

0 new messages