Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # set Cornerpond to 200% (1920x1080) and place it in the bottom right corner of the screen, above the Windows task bar.
- """
- - remove later
- 200% cornerpond is 388x322. top left corner coords (1532, 718).
- """
- import pyautogui
- import win32gui
- import win32api
- import win32con
- def autoTarget():
- hwnd = win32gui.FindWindow(None, 'Cornerpond')
- print(hwnd)
- target = pyautogui.locateCenterOnScreen(r'C:\PROGREAMMING\python projects\autoCornerpond\testTarget.png', region=(1532,718,388,322), confidence=0.85) # green target region=(1540,792,112,180),
- if target:
- """
- fix later. goal: send an emulated click w/o moving the actual cursor.
- convTarget = win32gui.ScreenToClient(hwnd, target)
- print(convTarget)
- win32api.PostMessage(hwnd, win32con.BM_CLICK, 0, 0)
- """
- pyautogui.click(target)
- print(f"Target found at {target}.")
- else:
- print("Invalid target.")
- # other goals: loop everything for more than a one-time use. see about using try/except, minSearchTime.
- autoTarget()
Advertisement
Add Comment
Please, Sign In to add comment