1. 移动鼠标   【所有的使用示例必须放到 script_main(self) 类函数下使用】           功能视频教程: https://www.bilibili.com/video/BV17E421g7ip/

    def move_mouse(self, hwnd: str, x: float, y: float, mode: bool = False, ele_hwnd: str = "0") -》 bool:
        """
            移动鼠标

            hwnd: 当前窗口句柄
            x: 横坐标
            y: 纵坐标
            mode: 操作模式,后台 True,前台 False, 默认前台操作
            ele_hwnd: 元素句柄,如果 mode=True 且目标控件有单独的句柄,则需要通过 get_element_window 获得元素句柄,
                      指定 ele_hwnd 的值(极少应用窗口由父窗口响应消息,则无需指定)
            return: 总是返回True

            hwnd: Current window handle
            x: abscissa
            y: ordinate
            mode: Operation mode, background True, foreground False, default foreground operation
            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)
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.move_mouse("4624", 800, 800, False, "0")
    print(result) 



2. 移动鼠标(相对坐标)          功能视频教程: https://www.bilibili.com/video/BV1xt421n7hv/

    def move_mouse_relative(self, hwnd: str, x: float, y: float, mode: bool = False) -》 bool:
        """
            移动鼠标(相对坐标, 相对于当前句柄窗口范围内的0,0坐标移动)
            Move the mouse (relative coordinates)

            hwnd: 当前窗口句柄
            x: 相对横坐标
            y: 相对纵坐标
            mode: 操作模式,后台 True,前台 False, 默认前台操作
            return: 总是返回True

            hwnd: Current window handle
            x: Relative abscissa
            y: Relative ordinate
            mode: Operation mode, background True, foreground False, default foreground operation
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.move_mouse_relative("4628", 50, 50, False)
    print(result) 

    

3. 滚动鼠标           功能视频教程: https://www.bilibili.com/video/BV1ZE421u75Y/


    def scroll_mouse(self, hwnd: str, x: float, y: float, count: int, mode: bool = False) -》 bool:
        """
            滚动鼠标
            Scroll mouse

            hwnd: 当前窗口句柄
            x: 横坐标
            y: 纵坐标
            count: 鼠标滚动次数, 负数下滚鼠标, 正数上滚鼠标
            mode: 操作模式,后台 True,前台 False, 默认前台操作
            return: 总是返回True

            hwnd: Current window handle
            x: abscissa
            y: ordinate
            count: The number of mouse scrolling, negative scrolling down, positive scrolling up
            mode: Operation mode, background True, foreground False, default foreground operation
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.scroll_mouse("4628", 80, 80, 5, False)
    print(result) 

    

4. 鼠标点击           功能视频教程: https://www.bilibili.com/video/BV1zD42157v2/

    def click_mouse(self, hwnd: str, x: float, y: float, typ: int, mode: bool = False, ele_hwnd: str = "0") -》 bool:
        """
            鼠标点击
            Mouse click

            hwnd: 当前窗口句柄
            x: 横坐标
            y: 纵坐标
            typ: 点击类型,单击左键:1 单击右键:2 按下左键:3 弹起左键:4 按下右键:5 弹起右键:6 双击左键:7 双击右键:8
            mode: 操作模式,后台 true,前台 false, 默认前台操作
            ele_hwnd: 元素句柄,如果 mode=True 且目标控件有单独的句柄,则需要通过 get_element_window 获得元素句柄,
                      指定 ele_hwnd 的值(极少应用窗口由父窗口响应消息,则无需指定);
            return: 总是返回True

            hwnd: Current window handle
            x: abscissa
            y: ordinate
            typ: Click type, click left key: 1 Right key: 2 Press left key: 3 Pop up left key: 4 Press right key: 5 Pop up right key: 6 Double click left key: 7 Double click right key: 8
            mode: Operation mode, background True, foreground False, default foreground operation
            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)
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.click_mouse("4699", 80, 80, 1, False, "0")
    print(result) 

    
    # 前台单击左键
    hwnd = self.find_window(None, "运行");
    result = self.click_mouse(hwnd, 80, 80, 1, False, "0")
    print(result) 
    
    # 后台单击左键(目标坐标点没有单独的句柄)
    result = self.click_mouse(hwnd, 80, 80, 1, True, "0")
    print(result) 
    
    # 后台单击左键(目标坐标点有单独的句柄)
    subHwnd = self.get_element_window(hwnd, "Window/Button[2]")
    result = self.click_mouse(hwnd, 100, 200, 1, True , subHwnd)
    print(result) 
    

5. 输入文本           功能视频教程: https://www.bilibili.com/video/BV1Ex421U7TM/


    def send_keys(self, text: str) -》 bool:
        """
            输入文本
            Input text

            text: 输入的文本
            return: 总是返回True

            text: Entered text
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.send_keys("PyAibote")
    print(result) 

    

6. 后台输入文本           功能视频教程: https://www.bilibili.com/video/BV1nq421w7Zu/


    def send_keys_by_hwnd(self, hwnd: str, text: str) -》 bool:
        """
            后台输入文本(杀毒软件可能会拦截)
            Enter text in the background (antivirus software may intercept it)

            hwnd: 窗口句柄
            text: 输入的文本
            return: 总是返回True

            hwnd: Window handle
            text: Entered text
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.send_keys_by_hwnd("78425" ,"PyAibote")
    print(result) 

    

7. 输入虚拟键值(VK)           功能视频教程: https://www.bilibili.com/video/BV18f421o7jr/


    def send_vk(self, vk: int, typ: int) -》 bool:
        """
            输入虚拟键值(VK) 
            Enter the virtual key value (VK)

            vk: VK键值  按键对照表: http://www.atoolbox.net/Tool.php?Id=815
            typ: 输入类型,按下弹起:1 按下:2 弹起:3
            return: 总是返回True    

            vk: VK key value key table: http://www.atoolbox.net/Tool.php?Id=815
            typ: Enter the type, press and pop up: 1 press: 2 pop up: 3
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.send_vk(18, 1)
    print(result) 

    

8. 后台输入虚拟键值(VK)           功能视频教程: https://www.bilibili.com/video/BV1RJ4m157R5/

      
    def send_vk_by_hwnd(self, hwnd: str, vk: int, typ: int) -》 bool:
        """
            后台输入虚拟键值(VK) (杀毒软件可能会拦截)
            Background input virtual key value (VK)

            hwnd: 窗口句柄
            vk: VK键值
            typ: 输入类型,按下弹起:1 按下:2 弹起:3
            return: 总是返回True   若是后台组合键,可使用sendVk 按下控制键(Alt、Shift、Ctrl...),再组合其他按键

            hwnd: Window handle
            vk: VK key value
            typ: Enter the type, press and pop up: 1 press: 2 pop up: 3
            return: Always returns True
        """

    # 使用示例 [Demo]
    result = self.send_vk_by_hwnd("48572", 18, 1)
    print(result)