import time import pyperclip from PIL import Image import pytesseract import pyautogui import pexpect import win32com.client as comctl #Find Image and Save im1 = pyautogui.screenshot(region=(0, 0, 100, 100)) im1.save("LieDetector.png", grayscale=True) #OCR prints to .txt pytesseract.pytesseract.tesseract_cmd = ( r"C:\Program Files (x86)\Tesseract-OCR\tesseract" ) img = "LieDetector.png" print(pytesseract.image_to_string(Image.open(img))) #Saves OCR data to clipboard with open ("LieDetector.txt", "w") as text_file: text_file.write(pytesseract.image_to_string(Image.open(img))) pyperclip.copy(pytesseract.image_to_string(Image.open(img))) #Paste clipboard to video game Captcha pyautogui.click(284, 60) time.sleep(1) pyautogui.click() time.sleep(1) wsh = comctl.Dispatch("WScript.Shell") wsh.SendKeys("^{v}") time.sleep(1) wsh.SendKeys("{ENTER}")