I'm trying to make a program that, when the left mouse button is pressed, the program automatically clicks the mouse repeatedly.
from pynput.mouse import Button, Controller, Listener
import time
import multiprocessing as mp
import keyboard
mouse = Controller()
sleepTime = 0.01
def on_click(*args):
global clicker
clicker = True
def Clicker():
while clicker == True:
mouse.click(Button.left)
time.sleep(sleepTime)
with Listener(on_click=on_click) as listener:
listener.join()
if __name__ == "__main__":
p1 = mp.Process(target=Clicker)
p1.start()
while True:
if keyboard.is_pressed("å"):
p1.kill()
quit()
This is what I have tried but can't seem to make it work