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.1)

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

项目结构

wechat_auto/
├── __init__.py  
├── core.py         # 主入口
├── window.py       # 窗口管理
├── chat.py         # 智能打开聊天
├── sender.py       # 发送消息和文件
├── clipboard.py    # 系统级文件复制
├── listener.py     # 监听消息
├── utils.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.1.tar.gz (11.9 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.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wechat_pc_auto-1.1.1.tar.gz
  • Upload date:
  • Size: 11.9 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.1.tar.gz
Algorithm Hash digest
SHA256 71fc81f8c0aab92f4992bad579b93528747bb075283986eaeb369f717e9a63be
MD5 0e45d1b8826f26d681b79fa9ce69430c
BLAKE2b-256 c735172d45944152f1a4b5d00ade7c6dc11347fe038a17738a72e121633ce3e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wechat_pc_auto-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3efaab5618246d95d7975b0160a6e2148153f940592541eb91ef774c0f3883bf
MD5 6b6e4816f79c97c7b9b61adc51653653
BLAKE2b-256 38082e3647991f0ab3a00b1925ea39ea9df3484d823c59c06e1086be66ac3f43

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