Created
August 28, 2024 17:35
-
-
Save mrexodia/2e1f405b4b39c54c9b4329a79fddb00b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import pyautogui | |
if __name__ == "__main__": | |
while True: | |
x, y = pyautogui.position() | |
h = 400 | |
count = 0 | |
print("testing...") | |
for i in range(h): | |
cy = y - int(h / 2) + i | |
try: | |
if pyautogui.pixelMatchesColor(x, cy, (255, 0, 0), 0): | |
count += 1 | |
print("red pixel found", count) | |
if count == 10: | |
print("red bar detected") | |
pyautogui.leftClick(x, cy) | |
time.sleep(1.0) | |
pyautogui.moveTo(x, y) | |
break | |
except OSError: | |
pass | |
pyautogui.moveRel(1, 0) | |
time.sleep(1.0) | |
pyautogui.moveRel(-1, 0) | |
time.sleep(1.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment