Script to keep the screen saver from activating

Is there a simple script I can run to keep a windows screensaver from going active while running a long test. I can’t disable the screen saver.

I’m running eggplant on a linux, the SUT is a windows box connected via Realvnc.


If the activity from the script isn’t keeping the screensaver from coming on, then I don’t know what you can do about it. Do you have long spans of time where you’re not moving the mouse at all?

Hi Tazman–

I would just write a little handler to wake the computer up (and unlock it if necessary):

to WakeFromScreenSaver
	moveTo (0,0),(50,50),(0,0)
	//unlock screen if necessary
	if ImageFound("loginScreen")
		click "PasswordField"
		typeText "myPassword", ENTER
	end if
end WakeFromScreenSaver

Hope this helps


Matt/Allen , Thanks for getting back to me. Yes, there are a lot of time that our test run without even touching the keyboard or mouse, unfortunately because of security policies we can’t disable the screen saver / logout capability. We have a lot of folks that are looking at the tool to be able to run test over night and checking their results in the morning. That why I told them they would need to have a routine or small script to run prior to the magic 15 minute screen saver activation period. If I put these lines of code in my main script, say around every 13 or 14 minute time frame, it would move the mouse just enough to keep the screen active without going into the screen saver mode?

If you just want to move the mouse, then Allen’s handler is more than you need. If you’re doing a long WaitFor and it’s not a problem to move the mouse while you’re waiting, you could rewrite the waitfor like this:

repeat while not imageFound("someImageThatTakesAWhileToAppear")
      MoveTo (100, 100)
      MoveTo (105, 105)
      // Wait 10 -- uncomment this line (and possibly change the parameter) if you want to move the mouse less frequently
end repeat

and if you’re doing this frequently, you could turn the above code into a handler with the image you’re waiting for as a parameter.