init
This commit is contained in:
64
README.md
Normal file
64
README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# yidaima - Umi-OCR 桌面自动化脚本
|
||||
|
||||
## 依赖与准备
|
||||
|
||||
- 启动 **Umi-OCR** 并开启 **HTTP 服务**(默认 `http://127.0.0.1:1224/api/ocr`)
|
||||
- 安装依赖:
|
||||
|
||||
```bash
|
||||
python -m pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## 快速验证
|
||||
|
||||
- 等待某个文字出现在屏幕上:
|
||||
|
||||
```bash
|
||||
python main.py --wait "确定" --timeout 20
|
||||
```
|
||||
|
||||
- 点击某个文字:
|
||||
|
||||
```bash
|
||||
python main.py --click "确定"
|
||||
```
|
||||
|
||||
## 局部区域 OCR(更快)
|
||||
|
||||
指定区域格式为 `left,top,width,height`(屏幕坐标):
|
||||
|
||||
```bash
|
||||
python main.py --wait "登录" --region 100,100,800,600
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
编辑 `config.yaml`:
|
||||
|
||||
- `umi_ocr.url`: Umi-OCR API 地址
|
||||
- `screenshot.default_region`: 默认 OCR 区域(null 为全屏)
|
||||
- `screenshot.prefer_mss`: 优先使用 mss 截图(更快),失败会自动回退
|
||||
|
||||
## Playwright 示例:百度搜索并截图
|
||||
|
||||
对应文档 `docs/baidu.md`,脚本入口:`baidu_playwright.py`。
|
||||
|
||||
安装依赖:
|
||||
|
||||
```bash
|
||||
python -m pip install -r requirements.txt
|
||||
python -m playwright install chromium
|
||||
```
|
||||
|
||||
运行(可见浏览器):
|
||||
|
||||
```bash
|
||||
python baidu_playwright.py --keyword "java教程"
|
||||
```
|
||||
|
||||
无头模式:
|
||||
|
||||
```bash
|
||||
python baidu_playwright.py --keyword "java教程" --headless
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user