Skip to content

Instantly share code, notes, and snippets.

@sotlucas
Last active April 25, 2019 16:33
Show Gist options
  • Select an option

  • Save sotlucas/d633185b19267fb6f088bbb52cdd3946 to your computer and use it in GitHub Desktop.

Select an option

Save sotlucas/d633185b19267fb6f088bbb52cdd3946 to your computer and use it in GitHub Desktop.
Simple autoclicker. Dependencies in comment.
import pyautogui
import keyboard
import sys
# Change this to whatever shortcut you want
start_shortcut = 'alt+x'
stop_shortcut = 'esc'
def info():
print(f'Press {start_shortcut} to start')
print(f'Press {stop_shortcut} to stop.')
def on_pressed():
running = True
while running:
pyautogui.click()
# TODO: implement a way to control time between clicks
if keyboard.is_pressed(stop_shortcut):
running = False
info()
keyboard.add_hotkey(start_shortcut, on_pressed)
keyboard.wait()
@sotlucas

Copy link
Copy Markdown
Author

It needs the following modules:
pip3 install pyautogui
pip3 install keyboard

To run it you first need to enter:
xhost + (not totally sure why though)
and then sudo python3 autoclicker.py (yes, with sudo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment