Driving a Windows GUI program from a script

穿精又带淫゛_ 提交于 2019-11-28 17:34:17

Give Autohotkey another look, from you requirements it seems fit for the job.

Alternatively check UI Automation from Microsoft: http://msdn.microsoft.com/en-us/library/ms747327.aspx and also white: http://white.codeplex.com/

Sikuli is a visual technology to automate and test graphical user interfaces (GUI) using images (screenshots). Sikuli includes Sikuli Script, a visual scripting API for Jython, and Sikuli IDE, an integrated development environment for writing visual scripts with screenshots easily. Sikuli Script automates anything you see on the screen without internal API's support. You can programmatically control a web page, a Windows/Linux/Mac OS X desktop application, or even an iphone or android application running in a simulator or via VNC.

Look at Sikuli, it worked for me.

Take a look at Automa - it is written in Python. It can be used either as a standalone tool or as a Python library in your own scripts:

from automa.api import *

It allows automation of any Windows application through commands like click, press, write, etc.

Some examples of the automation scripts can be found at http://www.getautoma.com/blog/category/ui-automation-examples

Disclaimer: I'm one of Automa's developers.

Look at this https://pywinauto.github.io/

You can use python script itself to control your windows application.

Advantage is:

  • no need to learn new language/syntax
  • integrates easily with other existing script

You can use PyAutoGUI library for Python which works on Windows, macOS, and Linux.

Must allow time delays between actions.

Example to type with quarter-second pause in between each key:

import pyautogui
pyautogui.typewrite('Hello world!', interval=0.25)

Here is the example to set up a 2.5-second pause after each PyAutoGUI call:

pyautogui.PAUSE = 2.5

Must allow composition of complex keyboard input.

Checkout keyboard control functions where you can use pyautogui.typewrite to type something out. You can pass variables to allow a complex keyboard input.

Event detection to trigger actions.

You can use locate functions to visually find something on the screen and make the condition based on that within a simple loop.

Solution must be free for commercial use.

It is licensed under the BSD which allows commercial use.


See also:

RIATest is not using Python but otherwise fits the bill. It is like Selenium but for Win32 and web.

RIATest uses Windows UI Automation API and can drive any Windows application that exposes its GUI to UI Automation properly (that includes all native and .NET apps).

Disclaimer: I work for Cogitek, the RIATest company.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!