Dec-06-2020, 03:07 PM
Hello, first of all I`m a complete noob. I followed a tutorial and made this so far. This detects a small icon 40x40 in size on my screen and it works great even if I block the icon by 50%.
"all" I need is a code line to spam a keyboard key after the bot sees the image.
Here is my code:
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
while 1:
if pyautogui.locateOnScreen('ircr.png', region=(300,700,400,400) , grayscale=True, confidence=0.8) != None:
print("I can see it")
time.sleep(0.5)
else:
print("I am unable to see it")
time.sleep(0.5)
"all" I need is a code line to spam a keyboard key after the bot sees the image.
Here is my code:
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
while 1:
if pyautogui.locateOnScreen('ircr.png', region=(300,700,400,400) , grayscale=True, confidence=0.8) != None:
print("I can see it")
time.sleep(0.5)
else:
print("I am unable to see it")
time.sleep(0.5)