Skip to main content

Cross-platform automation library — mouse, keyboard, screen, window, clipboard, shell

Project description

cua-auto

cua-auto is a lightweight, cross-platform automation library providing a synchronous, MIT-licensed pyautogui-style API for mouse, keyboard, screen, window, clipboard, and shell operations. It runs on Windows, macOS, and Linux using pynput for input control and pywinctl for window management.

import cua_auto.mouse as mouse
import cua_auto.keyboard as keyboard
import cua_auto.screen as screen
import cua_auto.window as window
import cua_auto.clipboard as clipboard
import cua_auto.shell as shell

# Mouse
mouse.click(100, 200)               # left click
mouse.right_click(100, 200)
mouse.double_click(100, 200)
mouse.move_to(500, 300)
mouse.mouse_down(100, 200)
mouse.mouse_up(100, 200)
mouse.drag(100, 200, 400, 500)      # start → end
mouse.scroll_up(3)
mouse.scroll_down(3)
x, y = mouse.position()

# Keyboard
keyboard.press_key("enter")
keyboard.type_text("hello world")
keyboard.hotkey(["ctrl", "c"])
keyboard.key_down("shift")
keyboard.key_up("shift")

# Screen
img = screen.screenshot()           # returns PIL.Image
png = screen.screenshot_bytes()     # raw PNG bytes
b64 = screen.screenshot_b64()      # base64 string
w, h = screen.screen_size()
x, y = screen.cursor_position()

# Window
title = window.get_active_window_title()
handle = window.get_active_window_handle()
handles = window.get_windows_with_title("Chrome")
name = window.get_window_name(handle)
x, y = window.get_window_position(handle)
w, h = window.get_window_size(handle)
window.activate_window(handle)
window.minimize_window(handle)
window.maximize_window(handle)
window.close_window(handle)
window.set_window_size(handle, 1280, 800)
window.set_window_position(handle, 0, 0)
window.open("https://example.com")  # or file path
pid = window.launch("notepad.exe")

# Clipboard
text = clipboard.get()
clipboard.set("hello")

# Shell
result = shell.run("echo hi")       # CommandResult
print(result.stdout, result.returncode)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cua_auto-0.1.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cua_auto-0.1.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file cua_auto-0.1.2.tar.gz.

File metadata

  • Download URL: cua_auto-0.1.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cua_auto-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2c5ac6002b12d08b03940e1f8ee547ed206f8b20280380dc8a688b0ab4a56d34
MD5 a7a9390f327ab8e12b61dad6ffbec519
BLAKE2b-256 69e898e6ecc7a3db4d7b4ba60f990423ad3556af018a750beb08900eef47e607

See more details on using hashes here.

File details

Details for the file cua_auto-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cua_auto-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cua_auto-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4e4bb9d5121791b6daf85779dd223f1aca9801836dd5bf2f322a01983c5328c
MD5 2a5278e11208ac921d7981be8528c63d
BLAKE2b-256 d9c3f82cf30b457b9ff6fe3104caa9cd45d35edc1f184ff4b85fbcbbbc1f5262

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page