Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyautogui import *
- import pyautogui
- import time
- import keyboard
- import random
- import win32api, win32con
- time.sleep(2)
- #650, 320, 600, 450
- def click(x,y):
- win32api.SetCursorPos((x,y))
- win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
- win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
- initial = time.time()
- while keyboard.is_pressed('q') == False:
- c_break = False
- pic = pyautogui.screenshot(region=(650, 320, 600, 450))
- x, y = pic.size
- for i in range(0,600,5): #X AXIS
- if c_break == True: break
- for j in range(0,450,5): #Y AXIS
- r,g,b = pic.getpixel((i,j))
- if (b in range(185,210)):#Color I am trying to click
- print(i, " and ",j)
- click(i+649,j+319)
- time.sleep(0.1)
- c_break = True
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement