-
Notifications
You must be signed in to change notification settings - Fork 1
/
clicker.py
48 lines (37 loc) · 855 Bytes
/
clicker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import pyautogui
from pynput.keyboard import *
#delay for clicking
delay = 1
resume_key = Key.f1
pause_key = Key.f2
exit_key = Key.esc
#False to disable these
pause = True
running = True
def on_press(key):
global running, pause
if key == resume_key:
pause = False
print("Resumed")
elif key == pause_key:
pause = True
print("Paused")
elif key == exit_key:
running = False
print("Exited")
def display_controls():
print("Controls:")
print("F1 = Resume")
print("F2 = Pause")
print("Esc = Exit")
def main():
lis = Listener(on_press=on_press)
lis.start()
display_controls()
while running:
if not pause:
pyautogui.click(pyautogui.position())
pyautogui.PAUSE = delay
lis.stop()
if __name__ == "__main__":
main()