Skip to main content

A stable WeChat PC automation tool for sending messages and files

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 自动化
  • 适配不同微信版本窗口类名
  • 智能选择最快方式进入聊天
  • 真正的文件剪贴板复制(非路径文本)
  • 模块化设计,易于扩展(如后续可加接收消息、自动回复等)

项目结构

wechat_auto/
├── core.py         # 主入口
├── window.py       # 窗口管理
├── chat.py         # 智能打开聊天
├── sender.py       # 发送消息和文件
├── clipboard.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.0.0.tar.gz (9.3 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.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wechat_pc_auto-1.0.0.tar.gz
  • Upload date:
  • Size: 9.3 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.0.0.tar.gz
Algorithm Hash digest
SHA256 5660c51c4b6a24f2f41d0460544248d99e1de51c6df61728c27c22347626a62d
MD5 8112fe25c45c6922ed4fe6a857b80557
BLAKE2b-256 800cbebcf6f25ee3fa22fe08a2aaada07469f9b81342164535f1a37867d20656

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wechat_pc_auto-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d53d1a31e0a97138258b5bc9e6c5d4bef748e29b776fbc0b57a2ae7555d246e
MD5 83a557e3dcbd471120200f9f1942e828
BLAKE2b-256 94bf490cf1b85e34934b2a3bbc86ad7475103829593015c7ad2be9ecd61d9e5a

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