← 返回 Skills 市场
sincerememe

macos-wechat-send

作者 三分天下 · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ⚠ suspicious
325
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install macos-wechat-send
功能描述
Automates sending messages on WeChat Mac by controlling the app via AppleScript and clipboard to reliably deliver text to specified contacts.
使用说明 (SKILL.md)

wechat-send - 微信自动发送技能

描述

通过 AppleScript 控制微信 Mac 版自动发送消息和文件。使用剪贴板复制粘贴方式,避免输入法影响。

触发场景:

  • 用户要求发送微信消息
  • 需要自动化微信操作
  • macOS 系统 + 微信 Mac 版环境

环境检查

  1. 系统检查 - 必须是 macOS
  2. 微信检查 - 微信必须已打开并登录
  3. 权限检查 - 需要辅助功能权限
# 检查微信是否运行
osascript -e 'tell application "System Events" to get name of every process' | grep -i wechat

使用方法

基本用法

# 发送单条消息
wechat-send "联系人名字" "消息内容"

# 发送多条消息(连续发送)
wechat-send "联系人名字" "消息 1" "消息 2" "消息 3"

# 发送文件
wechat-send "联系人名字" "/path/to/file.xlsx"

# 混合发送(文字 + 文件,按顺序发送)
wechat-send "联系人名字" "说明文字" "/path/to/file.pdf" "补充说明"

# 从 stdin 读取消息
echo "消息内容" | wechat-send "联系人名字"

参数说明

参数 说明
联系人名字 微信中的联系人名字,必须完全匹配
消息内容 要发送的消息文本(支持特殊字符)
文件路径 本地文件绝对路径,自动检测并发送

发送顺序

按参数顺序发送,用户可自由控制:

# 先文字后文件
wechat-send "罗红" "这是文件请查收" "/path/to/file.xlsx"

# 先文件后文字
wechat-send "罗红" "/path/to/file.xlsx" "请查收"

# 交错发送
wechat-send "罗红" "说明 1" "file1.xlsx" "说明 2" "file2.xlsx"

操作流程

文字消息发送

  1. 激活微信窗口(四重保障)

    • open -a WeChat
    • tell application "WeChat" to activate
    • set frontmost of process "WeChat" to true
    • perform action "AXRaise" of window 1
  2. 搜索联系人(仅第一条消息或新联系人时)

    • 新联系人:先用"文件传输助手"垫脚石确保聚焦 → 再搜索目标
    • 同一联系人:窗口已打开,直接发送
    • 按 ESC 清除状态 → Cmd+F 搜索 → 粘贴名字 → 回车打开
  3. 发送消息

    • 粘贴消息内容到剪贴板
    • Cmd+V 粘贴
    • 回车发送

文件发送

  1. 激活微信窗口(同上)

  2. 搜索联系人(仅第一条消息或新联系人时,同上)

  3. 复制文件

    • 激活 Finder
    • 选中目标文件(select POSIX file "路径"
    • Cmd+C 复制
  4. 粘贴发送

    • 切换回微信
    • Cmd+V 粘贴文件
    • 回车发送

连续发送优化

场景 行为
第 1 条 + 新联系人 垫脚石 → 搜索目标 → 发送
第 1 条 + 同一联系人 直接发送(窗口已打开)
第 2-N 条 直接粘贴发送(跳过搜索)

优势:

  • 连续发送时不重复搜索联系人
  • 每条消息间隔 0.5 秒,避免发送过快
  • 自动检测文件路径,区分文件和文字

脚本文件

  • wechat-send.py - 主脚本(支持文字 + 文件)
  • wechat-send.sh - 快捷脚本(参数解析)

依赖

  • Python 3
  • macOS AppleScript
  • pyautogui(可选)

常见问题

1. 辅助功能权限

如果提示权限不足:

系统设置 → 隐私与安全性 → 辅助功能

勾选"终端"或你使用的终端应用。

2. 联系人找不到

  • 检查名字是否完全匹配
  • 确认联系人确实存在
  • 尝试使用备注名

3. 文件发送失败

  • 确认文件路径正确且存在
  • 确认 Finder 有访问权限
  • 大文件可能需要更长时间

4. 消息发送失败

  • 确认微信已登录
  • 确认网络正常
  • 检查是否有多个同名联系人

示例

# 发送 5 个笑话
wechat-send "罗红" "笑话 1" "笑话 2" "笑话 3" "笑话 4" "笑话 5"

# 发送文件 + 说明
wechat-send "罗红" "/Users/sincere/Downloads/report.xlsx" "这是本月报表,请查收"

# 复杂场景:文字 + 多文件 + 文字
wechat-send "罗红" "以下是附件" "file1.pdf" "file2.xlsx" "有任何问题随时联系我"

⚠️ 免责声明

本工具仅供学习和个人使用。使用者应遵守:

  1. 微信服务条款
  2. 当地法律法规
  3. 道德规范

请勿用于骚扰、诈骗或其他非法活动。

安全使用建议
This skill appears to do what it says: drive WeChat via AppleScript and clipboard. Before installing or running it: 1) Inspect the bundled scripts yourself (they are included) to verify no unexpected network calls or extra commands. 2) Be aware you will need to grant Accessibility permissions to your terminal/osascript—this allows UI control and is required for the functionality. 3) The tool uses the clipboard and copies files via Finder—avoid running it when you have sensitive clipboard contents. 4) Note the skill writes a small state file (~/.openclaw/.../.last_contact) containing the last contact name; remove or relocate it if you prefer not to persist that data. 5) The shell wrapper includes a hardcoded path (/Users/sincere/...); adjust the virtualenv path on your machine if needed. If you want higher assurance, run the scripts in a controlled account or review/modify them before use.
功能分析
Type: OpenClaw Skill Name: macos-wechat-send Version: 1.0.2 The skill contains a potential AppleScript injection vulnerability in `wechat-send.py` within the `copy_file_in_finder` function, where the `abs_path` variable is inserted directly into an AppleScript string without sanitization. An attacker providing a specially crafted file path containing double quotes could execute arbitrary AppleScript commands. Additionally, `wechat-send.sh` contains hardcoded local paths (e.g., `/Users/sincere/`), which is a poor security practice and indicates a lack of environment generalization. While the tool's primary purpose is legitimate UI automation for WeChat, these implementation flaws pose a risk of exploitation.
能力评估
Purpose & Capability
Name/description match behavior: AppleScript + clipboard + Finder automation to send text/files via WeChat Mac. Required system items (macOS, WeChat running, accessibility permission) align with the stated purpose. No unrelated cloud credentials or unrelated binaries are requested.
Instruction Scope
SKILL.md and the scripts instruct the agent to activate WeChat, manipulate clipboard, run AppleScript (osascript), and interact with Finder—all necessary for GUI automation. The runtime will read/write a small state file (~/.openclaw/...) to track last contact; this is within scope but worth noting since it stores the last-contact name on disk. The scripts operate on local files only and do not attempt network exfiltration.
Install Mechanism
No install spec—instruction-only with bundled scripts. No external downloads or package installs are performed by the skill itself, minimizing install-time risk.
Credentials
The skill requires no environment variables or credentials. It does read/write a state file under the user's home (~/.openclaw/...), and the shell wrapper contains a hardcoded fallback path (/Users/sincere/.openclaw/...), which appears to be a developer artifact and may fail on other machines or leak a username if repackaged. No sensitive tokens are requested.
Persistence & Privilege
always:false and no modification of other skills or system-wide config. The only persistent effect is the state file storing the last-contact name; the skill also requires macOS Accessibility permission for the terminal/osascript to control the UI, which is standard for this kind of automation.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install macos-wechat-send
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /macos-wechat-send 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
- 支持自动发送微信文件(不限于文本消息,可顺序发送文件和多条消息)。 - 支持多条消息与文件混合批量发送,参数顺序即发送顺序。 - 自动区分文本内容与文件路径,发送流程更加智能。 - 连续发送同一联系人时自动优化,避免重复切换联系人和窗口。 - 提供多参数、stdin 方式、发送多种类型内容的用法示例和详细说明。
v1.0.1
v1.0.1 introduces smart "stepping stone" technology to improve message sending accuracy and efficiency. - Adds intelligent stepping stone: when sending multiple messages to the same contact, uses "File Transfer Assistant" to ensure focus; skips this step for new contacts to speed up. - Tracks the last messaged contact with a .last_contact state file. - Optimizes sending flow for both consecutive and switched contacts. - Adds clearer status outputs during operation.
v1.0.0
- Major update: Comprehensive rewrite and enhancement of documentation for improved usability and clarity. - Expanded usage instructions, troubleshooting, and environment checks in Chinese. - Enhanced description of automation steps and security precautions. - Usage now emphasizes clipboard-based input and provides detailed parameter explanations. - Outlines script files: wechat-send.py and wechat-send.sh; removes the old scripts/wechat_send.sh. - Added sections for common issues, dependency requirements, and potential future extensions.
元数据
Slug macos-wechat-send
版本 1.0.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

macos-wechat-send 是什么?

Automates sending messages on WeChat Mac by controlling the app via AppleScript and clipboard to reliably deliver text to specified contacts. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 325 次。

如何安装 macos-wechat-send?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install macos-wechat-send」即可一键安装,无需额外配置。

macos-wechat-send 是免费的吗?

是的,macos-wechat-send 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

macos-wechat-send 支持哪些平台?

macos-wechat-send 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 macos-wechat-send?

由 三分天下(@sincerememe)开发并维护,当前版本 v1.0.2。

💬 留言讨论