#🔒 Hi, i need help with my script idk a lot of coding...

5 messages · Page 1 of 1 (latest)

hallow cobalt
#

Well im currently trying to do a script:
the script is supposed to do an action when some letter appear on the screen but it just doesnt work

somber pollenBOT
#

@hallow cobalt

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hallow cobalt
#

thats my script : import pyautogui
import pytesseract
from PIL import Image
import time

pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

lettres_a_detecter = ['Z', 'Q', 'S', 'D']

def detecter_lettres():
x1, y1 = 790, 415
x2, y2 = 1132, 700
largeur = x2 - x1
hauteur = y2 - y1

screenshot = pyautogui.screenshot(region=(x1, y1, largeur, hauteur))

texte = pytesseract.image_to_string(screenshot)

return texte

def verifier_lettres(texte):
for lettre in lettres_a_detecter:
if lettre in texte:
print(f"Lettre {lettre} détectée!")

def simuler_presse(lettre):
pyautogui.press(lettre.lower())
time.sleep(0.1)

while True:
texte = detecter_lettres()

verifier_lettres(texte)

for lettre in lettres_a_detecter:
    simuler_presse(lettre)

time.sleep(0.1)
somber pollenBOT
#

@hallow cobalt

Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.