如何在 Python 中调用 AutoIt 脚本

发布于 2024-12-21 20:33:43 字数 161 浏览 3 评论 0原文

如何将 AutoIt EXE 文件调用为 Python 代码?

我需要添加到由 Selenium AutoIt 脚本生成的代码。

How can I call an AutoIt EXE file to Python code?

I need add to code which were generated by a Selenium AutoIt script.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉月流沐 2024-12-28 20:33:43

如果您只想运行 AutoIt 脚本,请使用 os.system 或 os.popen 并查看页面 运行脚本。如果您想从 Python 脚本调用 AutoIt 方法,则:

  1. 在系统中注册 AutoItX3.dll:regsvr32 AutoItX3.dll
  2. 安装 PyWin32
  3. 从代码中使用 AutoIt,如下所示:

    导入 win32com.client
    
    autoit = win32com.client.Dispatch("AutoItX3.Control")
    
    autoit.AnyAutoitMethod()
    

If you want to just run the AutoIt script then use os.system or os.popen and take a look at the page Running Scripts. If you want to call AutoIt methods from your Python script then:

  1. Register AutoItX3.dll in your system: regsvr32 AutoItX3.dll
  2. Install PyWin32
  3. Use AutoIt from your code as follows:

    import win32com.client
    
    autoit = win32com.client.Dispatch("AutoItX3.Control")
    
    autoit.AnyAutoitMethod()
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文