Skip to content

Instantly share code, notes, and snippets.

@deitry
Created July 30, 2023 22:42
Show Gist options
  • Save deitry/0ce5e9dd50c5e4d8e5aa16327fa123f3 to your computer and use it in GitHub Desktop.
Save deitry/0ce5e9dd50c5e4d8e5aa16327fa123f3 to your computer and use it in GitHub Desktop.
Simple script to simulate spacebar key pressing
"""Simulate space press once in random time between 1 and 120 seconds to prevent the computer from sleeping."""
import random
import pyautogui
while True:
# get a random int between 1 and 120
# delay = 10
delay = random.randint(1, 120)
pyautogui.sleep(delay)
pyautogui.press('space')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment