forked from isaychris/python-autoclicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoclicker.py
53 lines (42 loc) · 1.16 KB
/
autoclicker.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
49
50
51
52
53
import pyautogui
from pynput.keyboard import *
# ======== settings ========
delay = 1 # in seconds
resume_key = Key.f1
pause_key = Key.f2
exit_key = Key.esc
# ==========================
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("[Exit]")
def display_controls():
print("// AutoClicker by iSayChris")
print("// - Settings: ")
print("\t delay = " + str(delay) + ' sec' + '\n')
print("// - Controls:")
print(f"\t {resume_key.name} = Resume")
print(f"\t {pause_key.name} = Pause")
print(f"\t {exit_key.name} = Exit")
print("-----------------------------------------------------")
print(f'Press {resume_key.name} to start ...')
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()