python 自动点击微信 文件传输助手链接

from wxauto import WeChat
import pywinauto,time,sys,re,random
# 获取当前微信客户端
wx = WeChat()
 
# 获取会话列表
wx.GetSessionList()
 
# 输出当前聊天窗口聊天消息
##msgs = wx.GetAllMessage
##for msg in msgs:
##    print('%s : %s'%(msg[0], msg[1]))
#### 获取更多聊天记录
##wx.LoadMoreMessage()
##msgs = wx.GetAllMessage
##for msg in msgs:
##    print('%s : %s'%(msg[0], msg[1]))
## 
### 向某人发送消息(以`文件传输助手`为例)
##msg = '你好~'
##who = '文件传输助手'
##wx.ChatWith(who)  # 打开`文件传输助手`聊天窗口
##wx.SendMsg(msg)  # 向`文件传输助手`发送消息:你好~
## 
### 向某人发送文件(以`文件传输助手`为例,发送三个不同类型文件)
##file1 = 'D:/test/wxauto.py'
##file2 = 'D:/test/pic.png'
##file3 = 'D:/test/files.rar'
who = '文件传输助手'
wx.ChatWith(who)  # 打开`文件传输助手`聊天窗口
#wx.SendFiles(file1, file2, file3)  # 向`文件传输助手`发送上述三个文件
lba=[]
while 1:
    zxa=wx.GetLastMessage[2]
    if zxa not in lba:
        lba.append(zxa)
        pywinauto.mouse.double_click(button="left",coords=(800,300))
        time.sleep(random.randint(25,35))
        pywinauto.mouse.double_click(button="left",coords=(1265,30))
    time.sleep(2)

 coords=(800,300)坐标判断方法:当出现相应图片时,按PRTSC,打开画图软件,粘贴,通过标尺和网格线确定需要点击坐标位置 。

posted @ 2022-12-26 16:33  myrj  阅读(349)  评论(0编辑  收藏  举报