This release is a pre-release and may not be stable for production use.
ok-script
无界面、桌面与 Web 模式
自动化核心现已与 Qt 解耦。使用 ok-script 可无界面运行,使用
ok-script[qt] 启用原有桌面界面,或使用 ok-script[web] 启用 FastAPI
浏览器界面;对应命令为 ok run_task、ok gui 和 ok web。详见
运行时架构。
基于计算机视觉的 Python 自动化框架,面向 Windows 应用、Windows 游戏、安卓模拟器和 ADB 设备。
ok-script 提供 UI、截图与输入、设备控制、OCR、模板匹配、调试浮层、自动化测试、打包和增量更新能力。它使用 COCO 格式管理模板素材,并支持分辨率自适应与多语言界面。
特性
- 纯 Python 实现,免费开源,可直接使用 pip 生态中的第三方库
- 同一套任务代码可支持 Windows 客户端、安卓模拟器和 ADB 设备
- 支持 OCR、OpenCV 模板匹配以及 YOLO 等视觉方案
- 基于 COCO 标注管理模板素材,并根据屏幕分辨率自动缩放
- 内置截图、输入、设备控制和可视化调试工具
- 支持自动化测试、GitHub Actions 构建和安装包发布
- 支持多语言国际化和在线增量更新
快速安装
ok-script 支持 Python 3.11 及以上版本,推荐使用 Python 3.12。
python -m pip install ok-script
只安装应用所需的依赖配置。default 为无界面模式,Web、Qt、ADB 和 OCR
能力分别按需安装:
python -m pip install "ok-script[default]"
python -m pip install "ok-script[qt]"
python -m pip install "ok-script[web]"
python -m pip install "ok-script[adb]"
python -m pip install "ok-script[ocr]"
ok-script 不会自动选择 OpenCV。用户必须根据自己的应用选择版本,并且只安装
一个变体:opencv-python、opencv-contrib-python、opencv-python-headless
或 opencv-contrib-python-headless。
以无界面模式开发本仓库时,同时安装 pyproject.toml 中的 default 和 dev
依赖组;再根据需要添加 --group web、--group qt、--group adb 或
--group ocr:
python -m pip install --editable . --group default --group dev
如果要创建完整的自动化项目,建议从 ok-script-app 模板开始,而不是直接在本仓库中编写业务脚本。
文档
从文档中心选择适合你的阅读路径:
想先体验完整工具链,也可以使用基于 ok-script 的按键精灵项目 ok-py。
界面预览
| 任务配置 | 截图与交互 |
|---|---|
| 脚本与 API | 模板管理 |
|---|---|
查看界面与开发工具完整说明,包括模板识别调试浮层。
使用 ok-script 的项目
社区与发布
致谢
ok-script 的开发离不开以下开源项目:
- PyAppify:用于应用更新和打包。
- OnnxOCR:提供支持 Intel NPU 的 OCR, 支持通过 OpenVINO 或 ONNX Runtime 推理,并使用 PaddleOCR v5 模型。
- PySide6:提供基于 Qt 的桌面界面绑定。
- PyQt-Fluent-Widgets:Qt 界面使用的 Fluent UI 组件。
- OpenCV、NumPy 和 Pillow:用于图像处理和计算机视觉。
- FastAPI、Uvicorn 和 pywebview:用于 Web 界面支持。
- adbutils:用于 Android 设备连接。
上述依赖均受其各自许可证约束,详情请参阅对应项目页面。
许可证
本项目采用 Apache License 2.0 + Commons Clause 及附加条款。
允许的使用方式:
- 可用于闭源项目或商业项目。
- 可以 fork、本项目改进,并保持 fork 开源且免费。
限制:
- 禁止直接出售本项目,或仅改名、稍作修改后将其作为竞争产品出售或推广。
- 禁止将本项目用于黑客攻击、未授权访问、恶意软件、欺诈或其他违法活动。
- 任何使用 ok-script 的项目,都必须在项目网站、GitHub 或软件本身至少一处提及并链接 ok-script.com 或 ok-script GitHub。
- Qt UI 的使用还必须遵守 PyQt-Fluent-Widgets 的许可证。
Metadata
Release files for ok-script 2.0.15b2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ok_script-2.0.15b2.tar.gz | 1.2 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ok_script-2.0.15b2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.4 MB
Release files / ok_script-2.0.15b2.tar.gz
| Download URL | ok_script-2.0.15b2.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ecbf3bf5dff813d80fdfc5a50d4da9c2220b84506adf6e3501d061eb2a1de40
|
|
BLAKE2b-256 checksum How to use checksums |
f1aff81a7f4b71990d40d983e9082d8fdfd08669e78e28e1b44455a471e686fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / ok_script-2.0.15b2-py3-none-any.whl
| Download URL | ok_script-2.0.15b2-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f58e60d2fd6825ccf833c2ce7d290c0f93464c41224411ec9b9794ac6c03762c
|
|
BLAKE2b-256 checksum How to use checksums |
a125878b318ff882ccd59501aac91146613cce41f047ad71cf60665b2fd45ac8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for ok-script 2.0.15b2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.