60 lines
1.6 KiB
Markdown
60 lines
1.6 KiB
Markdown
|
|
# Pixel 6 Screen Reader Skill
|
|||
|
|
|
|||
|
|
## 功能
|
|||
|
|
Pixel 6 上的 OpenClaw 可以读取自己的屏幕内容(截图 + 界面文字)。
|
|||
|
|
|
|||
|
|
## 前提条件
|
|||
|
|
- Mac mini 上已通过 ADB 无线连接到 Pixel 6
|
|||
|
|
- 连接命令:`adb connect 192.168.1.138:36327`(端口可能变化)
|
|||
|
|
|
|||
|
|
## 使用方法
|
|||
|
|
|
|||
|
|
### 1. 截图
|
|||
|
|
在 Mac mini 上执行(Pixel 6 的 OpenClaw 通过 SSH 调用):
|
|||
|
|
```bash
|
|||
|
|
adb shell screencap -p /sdcard/screen.png
|
|||
|
|
adb pull /sdcard/screen.png ~/pixel6-screen.png
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 2. 读取界面文字
|
|||
|
|
```bash
|
|||
|
|
adb shell uiautomator dump /sdcard/ui.xml
|
|||
|
|
adb pull /sdcard/ui.xml ~/pixel6-ui.xml
|
|||
|
|
cat ~/pixel6-ui.xml
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 3. 模拟操作
|
|||
|
|
```bash
|
|||
|
|
# 唤醒屏幕
|
|||
|
|
adb shell input keyevent KEYCODE_WAKEUP
|
|||
|
|
|
|||
|
|
# 滑动解锁
|
|||
|
|
adb shell input swipe 500 1500 500 500
|
|||
|
|
|
|||
|
|
# 点击坐标
|
|||
|
|
adb shell input tap 540 1200
|
|||
|
|
|
|||
|
|
# 输入文字
|
|||
|
|
adb shell input text "Hello"
|
|||
|
|
|
|||
|
|
# 打开 App
|
|||
|
|
adb shell am start -n org.telegram.messenger/org.telegram.ui.LaunchActivity
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Pixel 6 自己读取屏幕的流程
|
|||
|
|
1. Pixel 6 的 OpenClaw 通过 SSH 连接到 Mac mini
|
|||
|
|
2. 在 Mac mini 上执行 ADB 命令
|
|||
|
|
3. 拉取截图/UI 数据到 Mac mini
|
|||
|
|
4. 通过 SSH 读取文件内容
|
|||
|
|
|
|||
|
|
## 示例:Pixel 6 查询自己的屏幕内容
|
|||
|
|
```bash
|
|||
|
|
# 在 Pixel 6 的 OpenClaw 里执行
|
|||
|
|
ssh user@192.168.1.x "adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png /tmp/pixel6.png" && scp user@192.168.1.x:/tmp/pixel6.png ~/.openclaw/workspace/data/
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## 注意事项
|
|||
|
|
- ADB 无线调试端口会变化,需要在 Pixel 6 的"开发者选项 → 无线调试"里查看
|
|||
|
|
- 截图需要屏幕唤醒状态
|
|||
|
|
- `uiautomator dump` 可以读取所有界面文字和按钮位置
|