如何用 python 控制桌面应用程序 windows

How to control desktop app windows with python

我正在尝试为 zoom.us 创建一个 python 机器人,但要加入会议,zoom 会告诉我们下载应用程序并从那里加入会议。有没有像 selenium 这样的 python 模块来控制桌面应用程序?我找到了 PyAutoIt,但是还有更好的吗?

没有完全理解你打算做什么,但也许pyautogui也能有所帮助

您必须下载桌面版缩放应用程序并使用 'pyautogui' 模块来自动化缩放应用程序的 GUI。这是我编写的用于自动化我的脚本。根据您的机器编辑应用程序的位置

import pyautogui
import time

pyautogui.FAILSAFE = False

class ZoomOpener():
    def __init__(self, meeting_id, password):
        self.meeting_id = meeting_id
        self.password = password

    def main(self):

        # clicks on zoom logo in the task bar and opens it
        time.sleep(1)
        pyautogui.click(550, 800, duration=0.2)

        # clicks on join button
        time.sleep(2)
        pyautogui.click(x=550, y=317, clicks=2, interval=0.2)

        # types the meeting id
        pyautogui.typewrite(self.meeting_id,interval=0.06)

        # clicks the join button
        time.sleep(2)
        pyautogui.click(x=690, y=487)

        # types the password
        time.sleep(5)
        pyautogui.click(x=550, y=317, clicks=2)
        pyautogui.typewrite(self.password, interval=0.06)


        # clicks the join button
        time.sleep(1)
        pyautogui.click(x=690, y=487, clicks=1)

        # final joining
        time.sleep(5)
        pyautogui.click(x=900, y=590, clicks=2, interval=2)


if __name__ == '__main__':
    time.sleep(10)
    zoom = ZoomOpener('9656400024', '123456')
    zoom.main()