1#you need to install pyautogui like this:
2#py.exe -m pip install pyautogui
3#then...
4import pyautogui,time
5while True:
6 pyautogui.click(100,100)
7 time.sleep(0.5)
1import pyautogui
2import time
3
4def click():
5 time.sleep(0.5)
6 pyautogui.click()
7
8def main():
9 for i in range(10):#you can set how much times you have to click in range(no. of times to click)
10 click()
11
12main()
1import threading
2from pynput.mouse import Button, Controller
3from pynput.keyboard import Listener, KeyCode
4
5
6delay = 0.001
7button = Button.left
8start_stop_key = KeyCode(char='s')
9exit_key = KeyCode(char='e')
10
11
12class ClickMouse(threading.Thread):
13 def __init__(self, delay, button):
14 super(ClickMouse, self).__init__()
15 self.delay = delay
16 self.button = button
17 self.running = False
18 self.program_running = True
19
20 def start_clicking(self):
21 self.running = True
22
23 def stop_clicking(self):
24 self.running = False
25
26 def exit(self):
27 self.stop_clicking()
28 self.program_running = False
29
30 def run(self):
31 while self.program_running:
32 while self.running:
33 mouse.click(self.button)
34 time.sleep(self.delay)
35 time.sleep(0.1)
36
37
38mouse = Controller()
39click_thread = ClickMouse(delay, button)
40click_thread.start()
41
42
43def on_press(key):
44 if key == start_stop_key:
45 if click_thread.running:
46 click_thread.stop_clicking()
47 else:
48 click_thread.start_clicking()
49 elif key == exit_key:
50 click_thread.exit()
51 listener.stop()
52
53
54with Listener(on_press=on_press) as listener:
55 listener.join()
1import pyautogui #imports pyautogui
2import keyboard #imports keyboard
3
4
5def autoclicker(): #declares the function
6 while True: #makes a infinite loop
7 pyautogui. click() #makes your mouse click
8 if keyboard.is_pressed('b'): #detects if b is pressed
9 break #if b is detected it breaks the loop
10
11
12autoclicker()
1def on_press(key):
2 if key == start_stop_key:
3 if click_thread.running:
4 click_thread.stop_clicking()