Archive for December, 2005

Disable mandatory screen saver

December 13th, 2005 | Category: Python

So you’re trying to watch a movie on your shiny new corporate laptop. Ten minutes into the film, the automatic screen saver kicks in, locks the machine and forces you to re-login. The little weasels at IT have even disabled the screen saver properties, so you can’t even turn it off.

Here’s a tiny python script that will fake keyboard activity every five minutes in order to prevent a screen saver from activating.

"""Fake keyboard activity to prevent screen
   saver from activating."""
import win32api
import win32con
import time

while True:
	print "Faking keyboard activity at", time.asctime()
	win32api.keybd_event(win32con.VK_SHIFT, 0, 0, 0)
	win32api.keybd_event(win32con.VK_SHIFT, 0, \\
                             win32con.KEYEVENTF_KEYUP, 0)
	time.sleep(60 * 5)

Download:

1 comment