Use Python to automatically send WeChat client messages (files, pictures, etc.)

tags: python  WeChat  Applets  rpa  Chat robot

Preliminary preparation

1. Environment
python 3.7, win10 64 -bit operating system

2. dependency package
uiautomation
pywin32

3. Code download
https://github.com/cluic/wxauto

4. Log in to WeChat PC client

Message

# wxauto's code is too long, in https://github.com/Cluic/wxauto
from wxauto import WeChat

 # Get the current WeChat client
wx = WeChat()

 # Get the session list
wx.GetSessionList()

 # Output current chat window Chat message
msgs = wx.GetAllMessage
for msg in msgs:
    print('%s : %s'%(msg[0], msg[1]))
 ## Get more chat records
wx.LoadMoreMessage()
msgs = wx.GetAllMessage
for msg in msgs:
    print('%s : %s'%(msg[0], msg[1]))

 # Send a message to someone (take the `file transfer assistant` as an example)
 msg = 'Hello ~
 Who = 'File Transfer Assistant'
 wx.chatwith (WHO) # Open the file transmission assistant `chat window
 wx.sendmsg (msg) # Send message to the file transfer assistant `: Hello ~

 # Send a file to someone (take the `file transfer assistant` as an example, send three different types of files)
file1 = 'D:/test/wxauto.py'
file2 = 'D:/test/pic.png'
file3 = 'D:/test/files.rar'
 Who = 'File Transfer Assistant'
 wx.chatwith (WHO) # Open the file transmission assistant `chat window
 wx.sendfiles (File1, File2, File3) # Send the above three files to the file transfer assistant `

Intelligent Recommendation

Python operates WeChat to automatically send messages (WeChat chat robot)

Preface I was learning python recently and found a small demo that automatically sends messages to WeChat. It feels very interesting. I tried it and it was unsuccessful. Because the demo uses the itch...

Python calls WIDOWS WeChat shortcut keys to automatically send WeChat messages

Principles You can perform the Windows button code, then call the shortcut key of the WeChat program, and then send the relevant messages, not to lose a batch of processing programs Expand You can cha...

Send messages automatically with python

Packages to be installed: Here is an example of grabbing the Jinshan Duba sentence. Effect picture: Reference materials: https://zhuanlan.zhihu.com/p/36398109        ...

Use Python to send corporate WeChat messages

Ready to work: Go to the corporate WeChat official website and register a company; log in to the corporate WeChat backend and create a "self-built" application to obtain the three necessary ...

Use python to send messages to enterprise WeChat

I. Overview This article will introduce how to use python3 to send messages to enterprise WeChat. My environment is linux + python3.6.10.   Two, python script The places that need to be modified,...

More Recommendation

Use Python to send WeChat messages regularly

Use Python to let WeChat send real-time information First, import the open CV library in the computer Press the shortcut key win+R to enter cmd Enter the code pip install python-opencv The installatio...

Use Python to send messages to corporate WeChat bots

How to add robots to the enterprise WeChat, install them in the python environment, do not go into details, directly upload the code Such as import request error ModuleNotFoundError: No module named &...

Automatically send messages to WeChat reminders

What is Server Sauce "Server Sauce", the English name "ServerChan", is a communication software between "mobile phone", "server" and "smart device". s...

Automatically send a WeChat message or a self-use code for QQ messages

Automatically send a WeChat message or a self-use code for QQ messages Waiting time function Send QQ message Send WeChat message 'Forced end VBS operation Key wonderful application here? 'Detect wheth...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top