Given : Playing in windowed mode, OS: Windows 10 x64
Objective : Write code in Python 3.7+
- Drag the mouse pointer to a specific position <— Works
- Hold down the left mouse button <— Does not work
- Move the mouse pointer to a specific position <— Works
- Release the left mouse button <— Works
What has been done :
import pyautogui import time # pyautogui.dragTo и pyautogui.drag не работают. pyautogui.moveTo(777, 777) time.sleep(0.5) pyautogui.mouseDown(button='left') time.sleep(0.5) pyautogui.moveTo(555, 555) time.sleep(0.5) pyautogui.mouseUp(button='left')
Result : The mouse pointer is moved to the specified point, the mouse button is not held down.
The libraries I used to solve this problem, but they didn't work :
Keystrokes, mouse movement, mouse clicks work fine.
The button is clamped … The thing is that the game cancels all clicks if the mouse does not move naturally.