Skip to content

Instantly share code, notes, and snippets.

@neomadara
Forked from eaorak/sss.py
Created June 22, 2018 00:55
Show Gist options
  • Save neomadara/af153c34cef43c358ff539823649f47f to your computer and use it in GitHub Desktop.
Save neomadara/af153c34cef43c358ff539823649f47f 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