python
import pyautogui
import time
import threading
import ctypes
import keyboard
auto_click_enabled = False
def click_thread():
while True:
if ctypes.windll.user32.GetAsyncKeyState(0x01) != 0 and auto_click_enabled:
pyautogui.click ()
time.sleep(0.1)
def toggle_auto_click():
global auto_click_enabled
auto_click_enabled = not auto_click_enabled
def start_auto_click():
click_thread = threading.Thread(target=click_thread)
click_thread.start()
keyboard.add_hotkey('F2', toggle_auto_click)
start_auto_click()