Guest User

autoCornerpond

a guest
Sep 23rd, 2025
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | Source Code | 0 0
  1. # set Cornerpond to 200% (1920x1080) and place it in the bottom right corner of the screen, above the Windows task bar.
  2.  
  3. """
  4. - remove later
  5. 200% cornerpond is 388x322. top left corner coords (1532, 718).
  6. """
  7.  
  8. import pyautogui
  9. import win32gui
  10. import win32api
  11. import win32con
  12.  
  13. def autoTarget():
  14.     hwnd = win32gui.FindWindow(None, 'Cornerpond')
  15.     print(hwnd)
  16.     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),
  17.     if target:
  18.         """
  19.        fix later. goal: send an emulated click w/o moving the actual cursor.
  20.        convTarget = win32gui.ScreenToClient(hwnd, target)
  21.        print(convTarget)
  22.        win32api.PostMessage(hwnd, win32con.BM_CLICK, 0, 0)
  23.        """
  24.         pyautogui.click(target)
  25.         print(f"Target found at {target}.")
  26.     else:
  27.         print("Invalid target.")
  28.  
  29. # other goals: loop everything for more than a one-time use. see about using try/except, minSearchTime.
  30.  
  31. autoTarget()
  32.  
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment