Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
drwanglaoshi avatar

Wechat

  • 1 installs
  • 1 repo stars
  • Updated February 28, 2026
  • drwanglaoshi/auto-wechat

Automate WeChat on Windows to wake the app, open a chat, and send text messages, files, or screenshots via a Python CLI using keyboard simulation.

About

Automates the Windows WeChat desktop client to send messages, files, and screenshots through a unified Python CLI. A developer uses it to integrate WeChat notifications into scripts or workflows.

  • Windows-API window wake independent of image recognition
  • Sends text, files, and desktop screenshots to a named chat

Wechat by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #1,983 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
  • Data as of Jul 8, 2026 (Skillselion catalog sync)
npx skills add https://github.com/drwanglaoshi/auto-wechat --skill wechat

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars1
Last updatedFebruary 28, 2026
Repositorydrwanglaoshi/auto-wechat

What it does

Automate WeChat on Windows to wake the app, open a chat, and send text messages, files, or screenshots via a Python CLI using keyboard simulation.

Files

SKILL.mdMarkdownGitHub ↗

WeChat Automation - 微信自动化

功能

整合微信自动化核心功能,提供统一的命令行入口:

  • 唤醒微信窗口
  • 搜索并打开聊天窗口
  • 发送文本消息
  • 发送文件/图片
  • 截取桌面并发送

何时使用

  • 需要快速发送微信消息/文件
  • 需要截图并发送到微信
  • 业务脚本中需要集成微信通知功能
  • 条码上传等完整流程的最后一步

使用方式

命令行调用

# 发送文本消息
python skills/wechat/scripts/main.py 文件传输助手 测试消息

# 发送文件/图片
python skills/wechat/scripts/main.py 文件传输助手 C:\path\to\image.png --file

# 不添加签名后缀
python skills/wechat/scripts/main.py 文件传输助手 测试消息 --no-signature

# 发送给指定联系人
python skills/wechat/scripts/main.py 张三 你好,最近怎么样?

Python 脚本调用

import subprocess

# 发送文本消息
subprocess.run([
    'python', 'skills/wechat/scripts/main.py',
    '文件传输助手', '测试消息'
])

# 发送文件
subprocess.run([
    'python', 'skills/wechat/scripts/main.py',
    '文件传输助手', 'C:\\image.png', '--file'
])

工作流程

┌─────────────────────────────────────────────────────────────┐
│                      wechat/main.py                          │
├─────────────────────────────────────────────────────────────┤
│  1. wake.py              → 唤醒微信窗口                     │
│  2. search_chat.py       → 搜索并打开聊天窗口               │
│  3. send_message.py      → 发送消息                         │
│     或                                                     │
│     send_file.py         → 发送文件                         │
└─────────────────────────────────────────────────────────────┘

脚本说明

scripts/main.py - 通用入口

功能: 微信自动化通用入口主脚本

执行方式:

python scripts/main.py <聊天名称> <消息内容>
python scripts/main.py <聊天名称> <文件路径> --file
python scripts/main.py <聊天名称> --screenshot

scripts/wake.py - 唤醒微信

功能: 使用 Windows API 唤醒微信窗口到最前

执行方式:

python scripts/wake.py

优势:

  • 不依赖图像识别
  • 不受窗口遮挡、多屏、DPI 影响
  • 支持快捷键备用方案(Ctrl+Alt+X)

scripts/search_chat.py - 搜索聊天

功能: 使用快捷键搜索并打开指定聊天窗口

执行方式:

python scripts/search_chat.py <聊天名称>

技巧: 使用 Ctrl+F 打开搜索框,剪贴板粘贴中文

scripts/send_message.py - 发送消息

功能: 在已打开的聊天窗口中发送文本消息

执行方式:

python scripts/send_message.py <消息内容>
python scripts/send_message.py <消息内容> --no-signature

前提: 聊天窗口已打开,光标已聚焦到输入框

scripts/send_file.py - 发送文件

功能: 发送文件/图片到微信聊天窗口

执行方式:

python scripts/send_file.py <文件路径>
python scripts/send_file.py <文件路径> <附加消息>

原理: 使用 PowerShell Set-Clipboard 复制文件到剪贴板

环境要求

项目要求
操作系统Windows 10/11
Python3.8+
微信PC 版已安装并登录
依赖库pyautogui, pyperclip

输出示例

发送文本消息

============================================================
微信自动化 - 发送文本消息
============================================================
目标聊天:文件传输助手
消息内容:测试消息...
============================================================

[步骤 1/4] 唤醒微信...
[步骤 2/4] 搜索'文件传输助手'...
[步骤 3/4] 发送消息到'文件传输助手'...
[步骤 4/4] 完成
============================================================
[OK] 消息已发送到:文件传输助手
============================================================

发送文件

============================================================
微信自动化 - 发送文件/图片
============================================================
目标聊天:文件传输助手
文件路径:C:\Users\Wang\.openclaw\workspace\image.png
============================================================

[步骤 1/4] 唤醒微信...
[步骤 2/4] 搜索'文件传输助手'...
[步骤 3/4] 发送文件到'文件传输助手'...
[步骤 4/4] 完成
============================================================
[OK] 文件已发送到:文件传输助手
============================================================

故障排除

微信未找到

[ERROR] 未找到微信窗口(微信可能未启动)

解决: 先手动启动微信客户端

文件不存在

[ERROR] 文件不存在:C:\path\to\file.png

解决: 检查文件路径是否正确,使用绝对路径

消息未发送

解决: 1. 确认微信已登录 2. 确认聊天窗口已打开 3. 检查微信是否正常响应

安全说明

  • 本脚本仅模拟键盘操作
  • 不会读取或存储聊天内容
  • 不会修改微信配置
  • 所有操作在本地完成

维护指南

修改微信快捷键

当前默认快捷键: Ctrl+Alt+S

如果微信的唤醒快捷键发生变化,只需修改以下 2 个文件:

文件位置修改内容
scripts/wake.py约第 104 行pyautogui.hotkey('ctrl', 'alt', 's')
scripts/search_chat.py约第 70、74 行pyautogui.hotkey('ctrl', 'alt', 's')(2 处)

修改步骤: 1. 修改 wake.py 中的快捷键 2. 修改 search_chat.py 中的快捷键(2 处) 3. 同时更新打印提示文字(如 [步骤 3] 重置微信窗口焦点(Ctrl+Alt+S × 2)...

快捷方式: 对 AI 说 "修改微信快捷键为 Ctrl+Alt+X",AI 会自动修改这 2 个文件。

更新日志

v2.0.0 (2026-02-28)

  • ✅ 整合 4 个分散的微信技能目录为一个
  • ✅ 简化脚本命名(wake.py, search_chat.py, send_message.py, send_file.py)
  • ✅ 统一入口脚本(main.py)支持文本/文件发送
  • ✅ 删除冗余独立脚本

v1.0.0 (2026-02-25)

  • ✅ 初始版本(分散的 4 个技能目录)

---

最后更新:2026-02-28 版本:2.0.0

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.