Skip to main content

AI agent skill for desktop automation using PyAutoGUI

Project description

Desktop Control Skill

🤖 AI Agent Skill for desktop automation using PyAutoGUI.

Control mouse, keyboard, and screen programmatically through a simple CLI interface.

⚡ Quick Install

Install with a single command:

pipx install desktop-agent


Or using uvx:

```bash
uvx desktop-agent

Or using pip:

pip install desktop-agent

🎯 For AI Agents

This project is packaged as an AI Agent Skill. To use it:

  1. Read the skill documentation: SKILL.md
  2. Install the CLI: Use pip install desktop-agent or pipx install desktop-agent
  3. Invoke commands: Use desktop-agent <category> <command>

Quick Reference for Agents:


📦 Installation

Using pipx (Recommended)

pipx install desktop-agent

Using pip

pip install desktop-agent

Run without installing (using uvx)

uvx desktop-agent

Usage

The CLI is organized into command categories:

🖱️ Mouse (mouse)

# Move mouse to coordinates
desktop-agent mouse move 100 200

# Move with duration (animation)
desktop-agent mouse move 100 200 --duration 1.0

# Click at current position
desktop-agent mouse click

# Click at specific coordinates
desktop-agent mouse click 500 500

# Right click
desktop-agent mouse right-click

# Double click
desktop-agent mouse double-click 300 400

# Drag to coordinates
desktop-agent mouse drag 200 300

# Scroll (positive = up, negative = down)
desktop-agent mouse scroll 5
desktop-agent mouse scroll -3

# Get current mouse position
desktop-agent mouse position

⌨️ Keyboard (keyboard)

# Write text
desktop-agent keyboard write "Hello World"

# Write with interval between keys
desktop-agent keyboard write "Slow typing" --interval 0.1

# Press a key
desktop-agent keyboard press enter

# Press multiple times
desktop-agent keyboard press a --presses 5

# Execute keyboard shortcut
desktop-agent keyboard hotkey "ctrl,c"
desktop-agent keyboard hotkey "ctrl,shift,esc"

# Hold/release key
desktop-agent keyboard keydown shift
desktop-agent keyboard keyup shift

🖼️ Screen (screen)

# Capture screenshot
desktop-agent screen screenshot my_screen.png

# Screenshot of specific region (x,y,width,height)
desktop-agent screen screenshot region.png --region "100,100,500,400"

# Locate image on screen
desktop-agent screen locate image.png

# Locate center of image
desktop-agent screen locate-center button.png --confidence 0.8

# Get pixel color
desktop-agent screen pixel 100 200

# Get screen size
desktop-agent screen size

# Check if coordinates are on screen
desktop-agent screen on-screen 5000 5000

# Find text coordinates on screen using OCR (partial search)
desktop-agent screen locate-text-coordinates "OK"

# Find text in specific image
desktop-agent screen locate-text-coordinates "Confirm" --image screenshot.png

# Case-sensitive search
desktop-agent screen locate-text-coordinates "Login" --case-sensitive

# Read all text from screen
desktop-agent screen read-all-text

# Read text from image
desktop-agent screen read-all-text --image capture.png

# Specify languages for OCR (default: pt,en)
desktop-agent screen locate-text-coordinates "Button" --lang "en"

💬 Messages (message)

# Show alert
desktop-agent message alert "Hello!"

# Confirmation
desktop-agent message confirm "Are you sure?"

# Input prompt
desktop-agent message prompt "Enter your name:"

# Password
desktop-agent message password "Enter your password:"

Automation Examples

Open Notepad and write

desktop-agent keyboard hotkey "win,r"
desktop-agent keyboard write "notepad"
desktop-agent keyboard press enter
# Wait for notepad to open...
desktop-agent keyboard write "Hello from Desktop Skill!"

Capture screenshot and analyze

desktop-agent screen screenshot full_screen.png
desktop-agent screen pixel 500 500

Available Commands

Run desktop-agent --help to see all commands:

desktop-agent --help
desktop-agent mouse --help
desktop-agent keyboard --help
desktop-agent screen --help
desktop-agent message --help

Project Structure

desktop-skill/
├── desktop_agent/       # Main package
│   ├── __init__.py
│   ├── commands/        # Command modules
│   │   ├── __init__.py
│   │   ├── mouse.py    # Mouse commands
│   │   ├── keyboard.py # Keyboard commands
│   │   ├── screen.py   # Screen/screenshot/OCR commands
│   │   └── message.py  # Message boxes
├── pyproject.toml      # Project configuration
└── README.md           # This documentation

Technologies

  • PyAutoGUI: GUI automation
  • EasyOCR: Optical character recognition
  • Typer: Modern CLI framework

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

desktop_agent-1.0.0.tar.gz (85.1 kB view details)

Uploaded Source

Built Distribution

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

desktop_agent-1.0.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file desktop_agent-1.0.0.tar.gz.

File metadata

  • Download URL: desktop_agent-1.0.0.tar.gz
  • Upload date:
  • Size: 85.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for desktop_agent-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f1dcd21f2e68893d2c58c43904eaddc4ee8d0193b90a61b7da8275212171d92f
MD5 d0dbc724917aeaf14bbc175366d82ea2
BLAKE2b-256 670317eedb29b33d3c43055f072a0b7029f050e69c056f7e789418ec500a96fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for desktop_agent-1.0.0.tar.gz:

Publisher: release.yml on patrickporto/desktop-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file desktop_agent-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: desktop_agent-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for desktop_agent-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb5ba026c9c754b599cf611eb7ff34f8ab65f15b2ea3bafe2cd39b97ff69c406
MD5 f61dc037264ff411e44ecee1ff9a3923
BLAKE2b-256 28c3ab89257a2e19b855953082ea4e92bc15b11e539b6270051e9f93f151b2a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for desktop_agent-1.0.0-py3-none-any.whl:

Publisher: release.yml on patrickporto/desktop-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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