键鼠操作 Keymouse operation
| 1 | |
| 2 | |
| 3 | class KeymouseOperation: |
| 4 | """ |
| 5 | 键鼠操作 |
| 6 | Keymouse operation |
| 7 | """ |
| 8 | |
| 9 | def move_mouse(self, hwnd: str, x: float, y: float, mode: bool = False, ele_hwnd: str = "0") -> bool: |
| 10 | """ |
| 11 | 移动鼠标 |
| 12 | |
| 13 | hwnd: 当前窗口句柄 |
| 14 | x: 横坐标 |
| 15 | y: 纵坐标 |
| 16 | mode: 操作模式,后台 True,前台 False, 默认前台操作 |
| 17 | ele_hwnd: 元素句柄,如果 mode=True 且目标控件有单独的句柄,则需要通过 get_element_window 获得元素句柄,指定 ele_hwnd 的值(极少应用窗口由父窗口响应消息,则无需指定) |
| 18 | return: 总是返回True |
| 19 | |
| 20 | hwnd: Current window handle |
| 21 | x: abscissa |
| 22 | y: ordinate |
| 23 | mode: Operation mode, background True, foreground False, default foreground operation |
| 24 | ele_hwnd: Element handle, if mode=True and the target control has a separate handle, you need to get the element handle through get_element_window, and specify the value of ele_hwnd (it is unnecessary to specify if the application window is rarely responded to by the parent window) |
| 25 | return: Always returns True |
| 26 | """ |
| 27 | return "true" in self.SendData("moveMouse", hwnd, x, y, mode, ele_hwnd) |
| 28 | |
| 29 | def move_mouse_relative(self, hwnd: str, x: float, y: float, mode: bool = False) -> bool: |
| 30 | """ |
| 31 | 移动鼠标(相对坐标) |
| 32 | Move the mouse (relative coordinates) |
| 33 | |
| 34 | hwnd: 当前窗口句柄 |
| 35 | x: 相对横坐标 |
| 36 | y: 相对纵坐标 |
| 37 | mode: 操作模式,后台 True,前台 False, 默认前台操作 |
| 38 | return: 总是返回True |
| 39 | |
| 40 | hwnd: Current window handle |
| 41 | x: Relative abscissa |
| 42 | y: Relative ordinate |
| 43 | mode: Operation mode, background True, foreground False, default foreground operation |
| 44 | return: Always returns True |
| 45 | """ |
| 46 | return "true" in self.SendData("moveMouseRelative", hwnd, x, y, mode) |
| 47 | |
| 48 | def scroll_mouse(self, hwnd: str, x: float, y: float, count: int, mode: bool = False) -> bool: |
| 49 | """ |
| 50 | 滚动鼠标 |
| 51 | Scroll mouse |
| 52 | |
| 53 | hwnd: 当前窗口句柄 |
| 54 | x: 横坐标 |
| 55 | y: 纵坐标 |
| 56 | count: 鼠标滚动次数, 负数下滚鼠标, 正数上滚鼠标 |
| 57 | mode: 操作模式,后台 True,前台 False, 默认前台操作 |
| 58 | return: 总是返回True |
| 59 | |
| 60 | hwnd: Current window handle |
nothing calls this directly
no outgoing calls
no test coverage detected