def send_input(n, action): s = control.nexus().comm.get_com("grids") int_a = int(action) response = None if int_a != 2: s.go(str(n)) elif int_a == 2: response = s.retrieve_data_for_highlight(str(int(n))) s.kill() grids.wait_for_death(settings.LEGION_TITLE) if int_a == 0: Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: Playback([(["mouse", "right", "click"], 0.0)]).execute() elif int_a == 2: x1 = response["l"] + 2 x2 = response["r"] y = response["y"] win32api.SetCursorPos((x1, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) win32api.SetCursorPos((x2, y)) time.sleep(0.1) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
def select_text(nexus): global x1, y1, x2, y2 x2, y2 = win32api.GetCursorPos() s = nexus.comm.get_com("grids") s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) drag_from_to(x1,y1,x2,y2)
def send_input_select(pre1, color1, n1, pre2, color2, n2, nexus): s = nexus.comm.get_com("grids") s.move_mouse(int(pre1), int(color1), int(n1)) _x1, _y1 = win32api.GetCursorPos() s.move_mouse(int(pre2), int(color2), int(n2)) _x2, _y2 = win32api.GetCursorPos() s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) drag_from_to(_x1,_y1,_x2,_y2)
def send_input_select(x1, y1, x2, y2, nexus): s = nexus.comm.get_com("grids") s.move_mouse(int(x1), int(y1)) _x1, _y1 = win32api.GetCursorPos() s.move_mouse(int(x2), int(y2)) _x2, _y2 = win32api.GetCursorPos() s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) drag_from_to(_x1, _y1, _x2, _y2)
def move_mouse(n, s, action): sudoku = control.nexus().comm.get_com("grids") sudoku.move_mouse(int(n), int(s)) # Close the grid window sudoku.kill() grids.wait_for_death(settings.SUDOKU_TITLE) time.sleep(0.1) perform_mouse_action(int(action))
def send_input(x, y, action, nexus): s = nexus.comm.get_com("grids") s.move_mouse(int(x), int(y)) int_a = int(action) if (int_a == 0) | (int_a == 1): s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) if int_a == 0: Mouse("left").execute() elif int_a == 1: Mouse("right").execute()
def send_input(pre, color, n, action, nexus): s = nexus.comm.get_com("grids") s.move_mouse(int(pre), int(color), int(n)) int_a = int(action) if (int_a == 0) | (int_a == 1) | (int_a == -1): s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) time.sleep(0.1) if int_a == 0: Mouse("left").execute() elif int_a == 1: Mouse("right").execute()
def drag_mouse(n0, s0, n, s, action): sudoku = control.nexus().comm.get_com("grids") x, y = sudoku.get_mouse_pos(int(n), int(s)) # If dragging from a different location, move there first if int(n0) > 0: sudoku.move_mouse(int(n0), int(s0)) sudoku.kill() grids.wait_for_death(settings.SUDOKU_TITLE) time.sleep(0.1) # Hold down click, move to drag destination, and release click win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) time.sleep(0.1) win32api.SetCursorPos((int(x), int(y))) time.sleep(0.1) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) time.sleep(0.3) perform_mouse_action(int(action))
def drag_highlight(n1, n2): s = control.nexus().comm.get_com("grids") response1 = s.retrieve_data_for_highlight(str(int(n1))) response2 = s.retrieve_data_for_highlight(str(int(n2))) s.kill() grids.wait_for_death(settings.LEGION_TITLE) x11 = response1["l"] + 2 x12 = response1["r"] y1 = response1["y"] x21 = response2["l"] + 2 x22 = response2["r"] y2 = response2["y"] win32api.SetCursorPos((x11, y1)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) win32api.SetCursorPos((x22, y2)) time.sleep(0.1) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)