简介
Python版本AutoIT,直接绑定到 AutoItX3.dll,然后就可以使用AutoIT的功能了。
安装
pip install -U pyautoit
例子
运行记事本,然后写入“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")
类似于注册AutoIT,然后调用的方法:
1、安装pywin32
pip3 install pywin32
2、从autoit3\AutoItX下找到AutoItX3_x64.dll AutoitX.dll,选择对应的32位/64位版本
3、注册dll文件(注意用管理员身份调用cmd)。
regsvr32 AutoItX3_x64.dll 或regsvr32 AutoitX.dll
4、调用
import win32com.client autoit = win32com.client.Dispatch("AutoItX3.Control") autoit.Run("NotePad.exe")
原文链接:https://blog.csdn.net/lilongsy/article/details/81607272