No project description provided
Project description
KeyGenie
鼠标和键盘操作录制工具,自动生成可执行的Python代码。
安装与使用
方式1:使用 uvx(推荐,无需安装)
无需安装,直接运行:
# 录制
uvx keygenie record
# 回放
uvx keygenie replay
# 带参数
uvx keygenie record -d /path/to/save
uvx keygenie replay /path/to/record.py
方式2:传统安装后使用
先安装包,然后使用 kg 命令:
# 先安装
pip install keygenie
# 或
uv pip install keygenie
# 然后使用
kg record
kg replay
开发模式安装
如果你想从源码开发或修改:
# 使用uv安装(推荐)
uv sync
uv pip install -e .
# 或使用pip
pip install -e .
使用
开始录制
kg record
# 指定保存目录
kg record -d /path/to/save
录制过程中执行操作,按 Ctrl+C 或按 q 键结束录制。
输出文件
录制完成后会在指定目录(默认 ./keygenie_records/)生成:
record.py- 可执行的Python代码record.md- 包含代码和截图的Markdown文档screenshots/- 截图文件夹
回放录制的操作
# 回放最近一次录制
kg replay
# 回放指定的文件
kg replay /path/to/record.py
# 在指定目录中查找并回放最新录制
kg replay -d /custom/path
回放时支持安全机制:
- 按下
ESC键可立即停止回放 - 鼠标移动到屏幕边缘时会自动停止回放
运行生成的代码
你也可以直接运行生成的 Python 文件:
python path/to/record.py
功能特性
- 录制鼠标点击、拖拽、滚动操作
- 录制键盘输入和快捷键
- 自动保存点击位置截图
- 生成带像素验证的安全点击代码
- 自动生成Markdown文档
- 一键回放录制的操作
- 回放时支持安全停止机制(ESC键或屏幕边缘检测)
- 跨平台键盘映射支持(Mac 上正确识别 Command 键)
系统要求
- Python >= 3.10
- macOS / Linux
- macOS需要授予辅助功能权限(系统设置 → 隐私与安全性 → 辅助功能)
项目结构
keygenie/
├── cli.py # 命令行接口
├── constant.py # 常量定义
├── recoder/ # 录制模块
│ └── recorder.py # 主录制器
├── runner/ # 运行模块
│ └── mouse/
│ └── mouse_operator.py # 鼠标操作器
└── utils/ # 工具模块
└── decorator.py # 装饰器
示例
生成的代码示例:
import pyautogui
from keygenie.runner.mouse.mouse_operator import MouseOperator
mouse_operator = MouseOperator()
mouse_operator.safe_click(219, 54, pixel=(237, 232, 215), tolerance=10)
# Mac 上会生成 'command',其他平台会生成 'ctrl'
pyautogui.hotkey('command', 'c') # macOS
# pyautogui.hotkey('ctrl', 'c') # Linux/Windows
mouse_operator.drag(100, 100, to_x=200, to_y=200)
键盘映射
- macOS:
cmd键映射为command,alt键映射为option - Linux/Windows:
cmd键映射为ctrl,alt键映射为alt
系统会自动根据运行平台生成正确的键盘映射代码。
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keygenie-0.0.1.tar.gz.
File metadata
- Download URL: keygenie-0.0.1.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
127daef862685544877f37b91af014ce8a14e7f3db5871aac92ea53069f01168
|
|
| MD5 |
fbca96f22623548620a4eb07e16449d9
|
|
| BLAKE2b-256 |
9bc21d3a0c89a775e8188f38c8335baa0c14174088bef2eff8c84538e9a0a8c9
|
Provenance
The following attestation bundles were made for keygenie-0.0.1.tar.gz:
Publisher:
release.yml on sijicuisite/MouseKeyboardRecorder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keygenie-0.0.1.tar.gz -
Subject digest:
127daef862685544877f37b91af014ce8a14e7f3db5871aac92ea53069f01168 - Sigstore transparency entry: 761520250
- Sigstore integration time:
-
Permalink:
sijicuisite/MouseKeyboardRecorder@e0f7d2445fb1bcf3a383b458722d8315d9e2a03c -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/sijicuisite
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e0f7d2445fb1bcf3a383b458722d8315d9e2a03c -
Trigger Event:
push
-
Statement type:
File details
Details for the file keygenie-0.0.1-py3-none-any.whl.
File metadata
- Download URL: keygenie-0.0.1-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48788a738d54a0fc4e083334d62b275cde1a1e6c6b8c0b7a5bd7106d469d0adc
|
|
| MD5 |
b8e7a37368643fb247d810c9bb59dd85
|
|
| BLAKE2b-256 |
50ff89e1e2edc3f3c7581bba07649a13be750000d4e4c21a3f2bcfd995cf3d9c
|
Provenance
The following attestation bundles were made for keygenie-0.0.1-py3-none-any.whl:
Publisher:
release.yml on sijicuisite/MouseKeyboardRecorder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keygenie-0.0.1-py3-none-any.whl -
Subject digest:
48788a738d54a0fc4e083334d62b275cde1a1e6c6b8c0b7a5bd7106d469d0adc - Sigstore transparency entry: 761520260
- Sigstore integration time:
-
Permalink:
sijicuisite/MouseKeyboardRecorder@e0f7d2445fb1bcf3a383b458722d8315d9e2a03c -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/sijicuisite
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e0f7d2445fb1bcf3a383b458722d8315d9e2a03c -
Trigger Event:
push
-
Statement type: