当前位置:   article > 正文

Python模块PyAutoIt调用AutoIT_py autoit

py autoit

简介

Python版本AutoIT,直接绑定到 AutoItX3.dll,然后就可以使用AutoIT的功能了。

安装

pip install -U pyautoit
  • 1

例子

运行记事本,然后写入“hello world”,最后不保存关闭。

import autoit

autoit.run("notepad.exe")
autoit.win_wait_active("[CLASS:Notepad]", 3)
autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
autoit.win_close("[CLASS:Notepad]")
autoit.control_click("[Class:#32770]", "Button2")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

类似于注册AutoIT,然后调用的方法:
1、安装pywin32

pip install pywin32
  • 1

2、从autoit3\AutoItX下找到AutoItX3_x64.dll AutoitX.dll,选择对应的32位/64位版本
3、注册dll文件(注意用管理员身份调用cmd)。

regsvr32 AutoItX3_x64.dll 或regsvr32 AutoitX.dll
  • 1

4、调用

import win32com.client
autoit = win32com.client.Dispatch("AutoItX3.Control")
autoit.Run("NotePad.exe")
  • 1
  • 2
  • 3

参考

https://pypi.org/project/PyAutoIt/
https://github.com/jacexh/pyautoit
https://github.com/mhammond/pywin32
https://blog.csdn.net/sophia_slr/article/details/41847999

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/851052
推荐阅读
相关标签
  

闽ICP备14008679号