English (United Kingdom)French (Fr)Deutsch (DE-CH-AT)
Who Is Online?
We have 378 guests online
Home Source Code AutoIt scripts How to prevent a screensaver from popping up
Most Recent
Featured Articles
Joomla 1.5 Featured Articles
Home Source Code AutoIt scripts How to prevent a screensaver from popping up
English (United Kingdom)French (Fr)Deutsch (DE-CH-AT)
How to prevent a screensaver from popping up E-mail
User Rating: / 2
Source Code - AutoIt scripts
Written by Thomas   
Sunday, 03 November 2013 06:35
Article Index
How to prevent a screensaver from popping up
Source code of PreventSS
All Pages


You may know that it's normally not difficult with Microsoft Windows to turn a screensaver off or back on again. It's probably just a matter of a few mouse clicks. In case you need some help there's plenty of resources on the net, for example this one for Windows Vista: Turn your screen saver on or off.

But what to do if the setting is disabled for some reason?


Image: A screenshot from Windows XP with the option to change the screensaver time limit disabled.










Tinkering with the screensaver can be prevented in many ways. One common reason why some settings might be greyed out (which means not available to the user) is the so-called Windows group policy ( This usually applies to company computers that belong to a Windows domain.

Without going deeper into all this stuff the idea arose for a little helper application that simply prevents the screensaver from popping up. This article shows a way of how this has been implemented for a tiny group of users but may be of interest for others too, hence this piece of code might be worth sharing. The computers of these users are part of a Windows domain and the group policy is set to disable screensaver changes. The screensavers pop up after a fixed time of 10 minutes (600 seconds).

The goal was to keep it as simple as possible, but also to keep it as useful as possible. In this regard the solution performs the action of simulating mouse moves. The actual implementation could have been carried out in many different ways but I decided that, because of its simple scripting language, AutoIt is very efficient for mouse and key stroke simulations. The other advantage of AutoIt is that it's freeware (but not open source).

The script PreventSS (i.e. Prevent ScreenSaver) waits for the time period provided as the first parameter. The time value is in seconds. After the time has elapsed it moves the mouse pointer by exactly one pixel towards the right and bottom. It then waits for the same time to reverse this action.

One pixel is such a small position change for the mouse that even if a user is working with the computer at the same time they would not notice anything. However, the movement is big enough to prevent the screensaver from opening when the computer is not used.

After using the little tool for some time another annoyance appeared. While PreventSS is running the screensaver won't show up anymore. Well, wasn't this its initial purpose?  Laughing

Maybe, yes, but after for example watching a movie it's easy to forget to switch on the screensaver manually or to close the software again. Since this issue has exposed itself several times PreventSS now supports a second parameter. This parameter specifies a time period after which the tool closes automatically. Note that I've decided to make the second parameter count minutes, not seconds. The length of feature films is usually given in minutes and most films are only up to 3 hours (180 minutes). An invokation of

PreventSS 550 180

seems like a good default setting if the screensaver is set to 10 minutes (600 seconds). Cool


Download the executable file alone (actually, that's all you really need):

Download PreventSS.exe (0.29 MiB = 295.3 KiB = 302,381 bytes)


Download the complete package, which includes the AutoIt source code script file, a Windows commandline script that can be used to compile the executable, and the executable file PreventSS.exe. To run the software only the executable file is required. If you have AutoIt installed you only need the script file PreventSS.au3 (see below).

Download (0.28 MiB = 282.3 KiB = 289,085 bytes)


Only the script file (AutoIt source code). You need AutoIt installed to run or compile the script.

Download PreventSS.au3 (0.00 MiB = 3.2 KiB = 3,230 bytes)


Last Updated on Thursday, 07 November 2013 08:12
You need to login or register to post comments.
Discuss this item on the forums. (0 posts)
Discuss (0 posts)