windows-ui-automation

TotalClaw 作者 totalclaw

使用 PowerShell 自动执行 Windows GUI 交互(鼠标、键盘、窗口)。当用户需要在桌面上模拟用户输入时使用,例如移动光标、单击按钮、在非 Web 应用程序中键入文本或管理窗口状态。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~wwb-daniel-windows-ui-automation
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~wwb-daniel-windows-ui-automation/file -o wwb-daniel-windows-ui-automation.md
## 概述(中文)

使用 PowerShell 自动执行 Windows GUI 交互(鼠标、键盘、窗口)。当用户需要在桌面上模拟用户输入时使用,例如移动光标、单击按钮、在非 Web 应用程序中键入文本或管理窗口状态。

## 原文

# Windows UI Automation

Control the Windows desktop environment programmatically.

## Core Capabilities

- **Mouse**: Move, click (left/right/double), drag.
- **Keyboard**: Send text, press special keys (Enter, Tab, Alt, etc.).
- **Windows**: Find, focus, minimize/maximize, and screenshot windows.

## Usage Guide

### Mouse Control

Use the provided PowerShell script `mouse_control.ps1.txt`:

```powershell
# Move to X, Y
powershell -File skills/windows-ui-automation/mouse_control.ps1.txt -Action move -X 500 -Y 500

# Click at current position
powershell -File skills/windows-ui-automation/mouse_control.ps1.txt -Action click

# Right click
powershell -File skills/windows-ui-automation/mouse_control.ps1.txt -Action rightclick
```

### Keyboard Control

Use `keyboard_control.ps1.txt`:

```powershell
# Type text
powershell -File skills/windows-ui-automation/keyboard_control.ps1.txt -Text "Hello World"

# Press Enter
powershell -File skills/windows-ui-automation/keyboard_control.ps1.txt -Key "{ENTER}"
```

### Window Management

To focus a window by title:
```powershell
$wshell = New-Object -ComObject WScript.Shell; $wshell.AppActivate("Notepad")
```

## Best Practices

1. **Safety**: Always move the mouse slowly or include delays between actions.
2. **Verification**: Take a screenshot before and after complex UI actions to verify state.
3. **Coordinates**: Remember that coordinates (0,0) are at the top-left of the primary monitor.