def main(): print(time.time()) print('Searching for window of CS...') hlcsWindowID = getWindowID() while hlcsWindowID == None: time.sleep(2) hlcsWindowID = getWindowID() print('Found CS at', hlcsWindowID) time.sleep(5) display = Display.Display() displayName = display.get_display_name() screen = display.screen() width = screen.width_in_pixels height = screen.height_in_pixels print('size1: {}x{}'.format(width, height)) xCenter = int(width / 2) yCenter = int(height / 2) xdo = Xdo() while True: time.sleep(0.01) screenShot = ImageGrab.grab(xdisplay=displayName).load() if scanArea(screenShot, xCenter, yCenter, 10, 10): xdo.click_window(hlcsWindowID, 1) target = findTarget(screenShot, xCenter, yCenter, 350, 200) if target != None: xdo.move_mouse(xCenter + target[0], yCenter + target[1])
# Must be run from pi, not ssh # https://github.com/rshk/python-libxdo from xdo import Xdo xdo = Xdo() xdo.move_mouse(200, 100)