Untitled
import pyautogui import keyboard import win32api import win32con from time import sleep # Initial click to set focus pyautogui.click(1400, 300, duration=1) def click(x, y): """Simulate a mouse click at the specified (x, y) coordinates.""" win32api.SetCursorPos((x, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) sleep(0.05) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0) # Main loop to check pixel color and click while not keyboard.is_pressed('1'): if pyautogui.pixelMatchesColor(1355, 300, (0, 0, 0)): click(1355, 300) if pyautogui.pixelMatchesColor(1455, 302, (0, 0, 0)): click(1455, 302) if pyautogui.pixelMatchesColor(1500, 294, (0, 0, 0)): click(1500, 294) if pyautogui.pixelMatchesColor(1559, 293, (0, 0, 0)): click(1559, 293)
Leave a Comment