Last active
March 26, 2024 07:42
-
-
Save nawanirakshit/f23580df6e3f50a7b7adbc2c9306be33 to your computer and use it in GitHub Desktop.
Are you Lazy or Idler? Use this Python Gist to move your cursor every minute to never get logged out from your office laptop and always stay online.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sched | |
import time | |
from pynput.mouse import Button, Controller | |
def do_something(scheduler): | |
# schedule the next call first | |
scheduler.enter(60, 1, do_something, (scheduler,)) | |
# Do work here | |
mouse = Controller() | |
# Set pointer position | |
mouse.position = (1040, 540) | |
# Press and release | |
mouse.press(Button.left) | |
mouse.release(Button.left) | |
my_scheduler = sched.scheduler(time.time, time.sleep) | |
my_scheduler.enter(60, 1, do_something, (my_scheduler,)) | |
my_scheduler.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment