from pyautogui import * import pyautogui import time import keyboard import random import win32api, win32con while keyboard.is_pressed('q') == False: pic = pyautogui.screenshot(region=(740,200,430,800)) width, height = pic.size for x in range(0, width, 5): for y in range(0, height, 5): if pyautogui.locateOnScreen('searchTM.png', region=(740,200,430,800),grayscale=False, confidence=0.96) !=None: an=pyautogui.locateCenterOnScreen('searchTM.png',grayscale=False, confidence=0.96) pyautogui.moveTo(an) pyautogui.leftClick() print('found searchTM') time.sleep(0.05) if pyautogui.locateOnScreen('confirmTM.png', region=(740,200,430,800),grayscale=False, confidence=0.96) !=None: an=pyautogui.locateCenterOnScreen('confirmTM.png',grayscale=False, confidence=0.96) pyautogui.moveTo(an) pyautogui.leftClick() print('found confirmTM') time.sleep(0.05) if pyautogui.locateOnScreen('confirmTM2.png', region=(740,200,430,800),grayscale=False, confidence=0.96) !=None: an=pyautogui.locateCenterOnScreen('confirmTM2.png',grayscale=False, confidence=0.96) pyautogui.moveTo(an) pyautogui.leftClick() print('found confirmTM2') time.sleep(0.05) if pyautogui.locateOnScreen('skipTM.png', region=(740,200,430,800),grayscale=False, confidence=0.96) !=None: an=pyautogui.locateCenterOnScreen('skipTM.png',grayscale=False, confidence=0.96) pyautogui.moveTo(an) pyautogui.leftClick() print('found skipTM') time.sleep(0.05) if pyautogui.locateOnScreen('confirmTM3.png', region=(740,200,430,800),grayscale=False, confidence=0.96) !=None: an=pyautogui.locateCenterOnScreen('confirmTM3.png',grayscale=False, confidence=0.96) pyautogui.moveTo(an) pyautogui.leftClick() print('found confirmTM3') time.sleep(0.05) if pyautogui.locateOnScreen('confirmTM4.png', region=(740,200,430,800),grayscale=False, confidence=0.96) !=None: an=pyautogui.locateCenterOnScreen('confirmTM4.png',grayscale=False, confidence=0.96) pyautogui.moveTo(an) pyautogui.leftClick() print('found confirmTM4') time.sleep(0.05) else: print("I am unable to see it")