T’m trying to create a script which once a color is found it clicks on it. I don’t know how though. What I do know is that the code would go right after the ‘try’ function.
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
import win32com.client as comclt
import subprocess
color =(255,213,0)
while 1:
try
time.sleep(0.1)
pyautogui.click(x,y)
time.sleep(1)
print (x,y)
time.sleep(5)
print ("I can see it!")
time.sleep(10)
pyautogui.hotkey('ctrl', '2')
time.sleep(10)
except ImageNotFoundException:
print ("Nope")
I’ve tried using a one pixel image of that color to find it but pyautogui just sends it to a corner.
New contributor
mmewtwosaysbye is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.