win32api.keybd_event(18,0,win32con.KEYEVENTF_KEYUP,0)
win32api.keybd_event(83,0,win32con.KEYEVENTF_KEYUP,0)
模拟发送微信消息
def SendWxMsg(wxid,sendtext):
先启动微信
FindWindow(‘微信’)
time.sleep(1)
定位到搜索框
pyautogui.moveTo(143, 39)
pyautogui.click()
搜索窗口
ClipboardText(wxid)
time.sleep(1)
进入窗口
pyautogui.moveTo(155, 120)
pyautogui.click()
粘贴文本内容
ClipboardText(sendtext)
SendMsg()
print(‘已发送’)
调用函数(微信号或微信昵称或备注,需要发送的文本消息)
SendWxMsg(‘face6009’,‘Python发送微信消息’)
动图演示
经过学习,我在想要不要用这个方法实现一套简单的微信操作脚本,然后写成HttpApi,然后通过Http进行调用,在网页实现简单的远程控制微信,或者做个机器人等