建设项目立项网站,asp漂亮的个人网站模板,网络舆情监测工作方案,更改wordpress主题用python进行windows端UI自动化的库有很多#xff0c;比如pywinauto等#xff0c;本文介绍一个使用autoit3来实现的 pyautoit 库pyautoit 是一个用python写的基于AutoItX3.dll的接口库#xff0c;用来进行windows窗口的一系列操作#xff0c;也支持鼠标键盘的操作。安装pip…用python进行windows端UI自动化的库有很多比如pywinauto等本文介绍一个使用autoit3来实现的 pyautoit 库pyautoit 是一个用python写的基于AutoItX3.dll的接口库用来进行windows窗口的一系列操作也支持鼠标键盘的操作。安装pip install pyautoitimport autoit # 注意引用的模块名跟安装的模块名是不一样的启动程序autoit.run(notepad.exe)窗口操作autoit.win_wait_active(title无标题- 记事本, timeout10) # 等待窗口激活autoit.win_exists(aaa) # 判断窗口是否存在autoit.win_get_handle(无标题- 记事本) # 获取窗口句柄autoit.win_activate(bbb) # 激活窗口autoit.win_close([CLASS:Notepad]) # 关闭窗口此处窗口标题的匹配模式也是可以自定义的默认是1 -- 匹配开始部分可以在脚本前面加上以下改为2--匹配子字符串autoit.opt(WinTitleMatchMode, 2)控件操作autoit.control_set_text(无标题, Edit1, 12312313123) # 输入文字autoit.control_click(titletitle, controlcontrolid) # 点击autoit.control_get_text(titletitle, controlcontrolid) # 获取控件文本autoit.control_command(titletitle, controlcontrolid, commandcommand)autoit.control_list_view(titletitle, controlcontrolid, commandcommand)autoit.control_tree_view(titletitle, controlcontrolid, commandcommand) 进程操作autoit.process.process_wait(processprocess, timeout10)autoit.process.process_close(process)autoit.process.process_exists(process)鼠标操作autoit.mouse_click(buttonleft, x100, y200, clicks1, speed-1)autoit.mouse_move(x200, y300, speed-1)autoit.mouse_wheel(directiondown)键盘操作autoit.send(12312412)autoit.send({F10}) # 发送shiftF10右键效果autoit.send(^a) # 发送ctrla其他autoit.shutdown(2)0 Logoff 1 Shutdown 2 Reboot 4 Force 8 Power down