Skip to main content

pyautomation

pyautomation is a set of Python modules designed to automate the Microsoft Windows GUI, specifically without interacting with the mouse cursor and keyboard. At its simplest, it allows you to post mouse and keyboard events to Windows dialogs and controls.

With the pyautomation package, you can control your GUI automatically while simultaneously controlling the mouse and keyboard physically, similar to how selenium automates web browsers.

Create virtual environment(Recommended)

python -m venv myvenv
source ./myvenv/Scripts/activate

Installation

pip install python-automation

How to use

## Handle Usage
import os, time
import pyautomation.pyauto as pyapp
os.system ('notepad.exe')
time.sleep(3)
window = pyapp.msauto.WindowControl(searchDepth=1, ClassName='Notepad')

config = pyapp.ConfigLoader.load_config(desired_parent_name= window.Name, desired_child_name= "Text editor")
wa = pyapp.WinAuto(config=config)
result, depth = wa.walk_and_find(window)
wa.type_text(result.NativeWindowHandle, "hello notepad!")



## Load configuration
# config_path = r'.\config\pyauto.json'
# config = pyauto.ConfigLoader.load_config(config_path)
config = pyapp.ConfigLoader.load_config(desired_parent_name= "test.py - python-autoevent - Visual Studio Code", desired_child_name= "Docker", monitor_index=1)

wa = pyapp.WinAuto(config=config)


## search parent and child
root = pyapp.msauto.PaneControl(Name=config.desired_parent_name)

child, child_depth = wa.walk_and_find(root, debug=True)
wa.get_info(child, child_depth, "Target")
wa.get_info(child.GetParentControl(), child_depth-1, "Target Parent")


## click relative location
x, y = wa.get_relative_location(root, child)
wa.click_relative_location(root, x, y)


## click absolute location
wa.click_at(38, 864, visible=False)
# wa.click_at(4501, 1394, visible=True)


## get current mouse location & drag mouse
wa.get_mouse_location()
# wa.drag_mouse([100, 1], [150, 100], time=1, visible=False) 


## Image feature matching
import pyautomation.pyautovision as vs
min_match_count=15
template_path= r".\imgs\fcfb.jpg"

a = vs.image_matcher(monitor_index=0, min_match_count=min_match_count, template_path=template_path, show=False)
print(a.object_center, a.object_location)


## click from image
# if a.object_center is not None:
wa.click_at(a.object_center[0], a.object_center[1], visible=False)


## monitor info
import pyautomation.displayinfo as pydis
print(pydis.DisplayInfo().get_scale_factor(pydis.DisplayInfo().get_Qapp()))
print(pydis.DisplayInfo().get_screen_info())

How to download inspect.exe

Click this git repo or MS Official Website for inspect

Metadata

Release files for python-automation 0.6.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-automation 0.6.4
File Size Uploaded
python-automation-0.6.4.tar.gz 191.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-automation 0.6.4
File Interpreter ABI Platform
python_automation-0.6.4-py3-none-any.whl Python 3 none any Details

Total release size: 403.1 kB

Release files / python-automation-0.6.4.tar.gz

Download URL python-automation-0.6.4.tar.gz
Size 191.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fd9489cda2bc85a36882c3e1bdb8d4cf181a29261601fd755eeafefe39dad347
BLAKE2b-256 checksum
How to use checksums
a3b99ee153ff5c56976f81e7770179f9737518acc7a7a963dd0c07ce60cae28d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.11

Release files / python_automation-0.6.4-py3-none-any.whl

Download URL python_automation-0.6.4-py3-none-any.whl
Size 211.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30393a79b4a1aa10c270007f861e84fed13faa1f2cb7033e5e7f3829a8e876e2
BLAKE2b-256 checksum
How to use checksums
c319d49e50af2b72038d462e84c8b95d54d6145355e34fa819a933a27a20001a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.6.4 This release

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.5

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page