Advertisement
kbb_1

Untitled

Feb 27th, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. from pyautogui import *
  2. import pyautogui
  3. import time
  4. import keyboard
  5. import random
  6. import win32api, win32con
  7.  
  8.  
  9. time.sleep(2)
  10.  
  11.  
  12. #650, 320, 600, 450
  13.  
  14. def click(x,y):
  15. win32api.SetCursorPos((x,y))
  16. win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
  17. win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
  18.  
  19. initial = time.time()
  20.  
  21. while keyboard.is_pressed('q') == False:
  22.  
  23. c_break = False
  24.  
  25. pic = pyautogui.screenshot(region=(650, 320, 600, 450))
  26.  
  27. x, y = pic.size
  28.  
  29. for i in range(0,600,5): #X AXIS
  30.  
  31. if c_break == True: break
  32.  
  33. for j in range(0,450,5): #Y AXIS
  34.  
  35. r,g,b = pic.getpixel((i,j))
  36.  
  37. if (b in range(185,210)):#Color I am trying to click
  38. print(i, " and ",j)
  39. click(i+649,j+319)
  40. time.sleep(0.1)
  41. c_break = True
  42. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement