UI 自动化 PythonUIAutomation4Windows

码农软件 · 软件分类 · UI组件库 · 2019-08-02 05:57:27

软件介绍

使用Python封装Windows UIAutomation API,支持MFC,Windows Forms,WPF,Metro,Qt,Firefox等程序的UI自动化,使得编写UI自动化脚本非常容易,支持平台Windows 7/8/8.1/10。

代码原理介绍

示例代码:自动化操作记事本

#!python3
# -*- coding:utf-8 -*-
import time
import subprocess
import automation

def AutomateNotepad():
    automation.ShowDesktop()
    #打开notepad
    subprocess.Popen('notepad')
    #查找notepad, 如果name有中文,python2中要使用Unicode
    window = automation.WindowControl(searchDepth = 1, ClassName = 'Notepad', SubName = '无标题 - 记事本')
    #查找edit
    edit = window.EditControl()
    time.sleep(1)
    edit.SetValue('hi你好')
    edit.SendKeys('{Ctrl}{End}{Enter 2}Welcome to use Python UIAutomation for Windows{! 4}{ENTER}', 0.1)
    time.sleep(1)
    window.Close()
    time.sleep(1)
    buttonNotSave = window.ButtonControl(SubName = '不保存')
    buttonNotSave.Click()
    # or send alt+n to not save and quit
    # automation.SendKeys('{ALT}n')

if __name__ == '__main__':
    AutomateNotepad()

其它例子:

使用python UIAutomation从QQ2016(8.0)群界面获取所有群成员详细资料

自动化重命名pdf书签

使用foxit pdf reader自动化重命名pdf书签

本文地址:https://codercto.com/soft/d/11452.html

The Linux Programming Interface

The Linux Programming Interface

Michael Kerrisk / No Starch Press / 2010-11-6 / GBP 79.99

The Linux Programming Interface describes the Linux API (application programming interface)-the system calls, library functions, and other low-level interfaces that are used, directly or indirectly, b......一起来看看 《The Linux Programming Interface》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

MD5 加密
MD5 加密

MD5 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具