Skip to main content

Stable WeChat PC automation tool: send messages, files, and auto-reply

Project description

wechat-pc-auto

PyPI version Python versions License: MIT Stars

一个稳定、纯 UI 自动化的微信 PC 版消息与文件发送工具,基于 uiautomation 实现,无需截图识别。

支持发送文本、多文件,智能打开聊天,适配最新微信版本。

适用于:监控告警、定时汇报、日志推送、文件自动传输等场景。

安装

pip install wechat-pc-auto

快速开始

from wechat_auto import WxAuto

wx = WxAuto()
wx.load_wechat()  # 自动激活微信

# 发送消息 + 文件到文件传输助手
wx.send_msg("自动化测试成功!\n多行消息正常显示", who="文件传输助手")
wx.send_files([
    "C:/report.pdf",
    "C:/screenshot.jpg"
], who="文件传输助手")

查看完整示例:examples/demo_send_to_file_helper.py

注意事项

  • 仅支持 Windows 系统 + 微信 PC 版
  • 请确保微信已登录且未被最小化
  • 首次运行可能需要管理员权限(uiautomation 需要)
  • 不支持发送表情包(可发送文本中的emoji)

项目特点

  • 无需截图识别,完全基于 UI 自动化
  • 适配不同微信版本窗口类名
  • 智能选择最快方式进入聊天
  • 真正的文件剪贴板复制(非路径文本)
  • 模块化设计,易于扩展(如后续可加接收消息、自动回复等)

新特性(v1.1.0)

  • 支持实时监听新消息
  • 自动识别未读红点并点击
  • 智能判断消息是否为别人发的
  • 支持自定义自动回复逻辑

v1.1.2 修复bugs

  • “复制文件到剪贴板异常:argument 1: OverflowError: int too long to convert” bug
  • 当微信窗口在最上层时,不再发送 Ctrl+Alt+W 激活微信窗口

项目结构

wechat_auto/
├── __init__.py  
├── core.py         # 主入口
├── window.py       # 窗口管理
├── chat.py         # 智能打开聊天
├── sender.py       # 发送消息和文件
├── clipboard.py    # 系统级文件复制
├── listener.py     # 监听消息
└── logger.py       # 日志

开源协议

MIT License - 随意使用、修改、商用均可

致谢

感谢 uiautomation 作者 yinkaisheng,以及所有在调试过程中提供反馈的用户。

Star 支持一下吧,让更多人用上稳定的微信自动化工具

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wechat_pc_auto-1.1.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wechat_pc_auto-1.1.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file wechat_pc_auto-1.1.2.tar.gz.

File metadata

  • Download URL: wechat_pc_auto-1.1.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for wechat_pc_auto-1.1.2.tar.gz
Algorithm Hash digest
SHA256 3bb517d6d2e58bb458870f8a15b599b4d30a3e0431a4689360dfe3a7beadfe17
MD5 24c1c1325e518c046cc1ac63a6363b07
BLAKE2b-256 014806eab49557b368d9d7c2b24a0f4bc8f0bf4174b6ed416d0ad5748b35398b

See more details on using hashes here.

File details

Details for the file wechat_pc_auto-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: wechat_pc_auto-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for wechat_pc_auto-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca14c28d4ef5507074f307b07b526c450200f56baadd418078fca317b8183c6
MD5 071506690cd5ad0b50f3412b167bb485
BLAKE2b-256 ab5dee3fc6a91fded696a3892daa0dbb32d066325d449dfcc5caf00b5e060041

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page