Skip to content

Instantly share code, notes, and snippets.

@eaorak
Created October 11, 2012 07:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save eaorak/3870798 to your computer and use it in GitHub Desktop.
Save eaorak/3870798 to your computer and use it in GitHub Desktop.
Python - Screen Saver "Saver" Script
#!/usr/bin/python
# This script prevents screen saver get activated by moving mouse periodically.
# EAO-09.2012
import win32api, time
print "Die screensaver !"
dif=1
exc=False
while True:
try:
pos=win32api.GetCursorPos()
time.sleep(30)
curPos=win32api.GetCursorPos()
print "Hmm.. let's see what we have.."
if pos == curPos:
newPos=(curPos[0],curPos[1]+dif)
print "Let's move to %s from %s" % (newPos,pos)
dif*=-1
win32api.SetCursorPos(newPos)
exc=False
except:
if not exc:
print "Something bad happened.. But never mind."
exc=True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment