pos机做网站推广,深圳市网站哪家做的好,做企业网站需要注意哪些,投资平台本篇文章实现了微信自动接收最新的实时聊天信息#xff0c;并对当前实时的聊天信息做出对应的回复。
可以自行接入人工智能或者结合自己的业务来做出自动回复。
下面视频是软件实际效果 自动接收消息并回复 实现的逻辑是实时监控微信的聊天面板中UI对象来判断是否有最新的消…本篇文章实现了微信自动接收最新的实时聊天信息并对当前实时的聊天信息做出对应的回复。
可以自行接入人工智能或者结合自己的业务来做出自动回复。
下面视频是软件实际效果 自动接收消息并回复 实现的逻辑是实时监控微信的聊天面板中UI对象来判断是否有最新的消息过来如果没有则继续监听如果有则点击UI对象切换到当前聊天面板并找到聊天面板中的输入框和发送按钮元素来进行回复。
1监控聊天面板中的UI对象 public override void Start(){if (State TaskState.Stop){State TaskState.Runing;}else {return;}Thread th new Thread(new ThreadStart(() {while (State TaskState.Runing){var currentChatList UI_WX_Window.Current.Find(/Pane/Pane[1]/Pane[2]/Pane/Pane/Pane/List);if (currentChatList null || currentChatList.ControlType ! FlaUI.Core.Definitions.ControlType.List){Thread.Sleep(1000);continue;}var source currentChatList.FindAllChildren();var tempMessageSource new ListWXRealMsgEntity();source.ToList().ForEach(item {if (item.ControlType FlaUI.Core.Definitions.ControlType.ListItem){var buttonName item.FindFirstByXPath(/Pane/Button)?.Name;var time item.FindFirstByXPath(/Pane/Pane/Pane[1]/Text)?.Name;var lastMessage item.FindFirstByXPath(/Pane/Pane/Pane[2]/Text)?.Name;var count item.FindFirstByXPath(/Pane/Text)?.Name;var messageitem new WXRealMsgEntity { UserName buttonName, Time time, CurrentMessage lastMessage, Count count };tempMessageSource.Add(messageitem);if (historyMessageSource ! null){//与历史消息比较//var cnt historyMessageSource.Count(s s.UserName messageitem.UserName// messageitem.Time s.Time// messageitem.CurrentMessage s.CurrentMessage// messageitem.Count s.Count);var cnt historyMessageSource.Count(s s.UserName messageitem.UserName messageitem.CurrentMessage s.CurrentMessage);if (cnt 0){//有新消息SetMessage(messageitem.UserName 发送给新消息你: messageitem.CurrentMessage);if (ReplyUser.Count(ss ss.Contains(messageitem.UserName))0){//自动回复UI_WX_Window.Current.ClickElement(item);Thread.Sleep(200);SendWXMsg(messageitem.UserName,ReplyMessage);//需要将历史消息本条重置SetMessage( 自动回复消息给messageitem.UserName: ReplyMessage);messageitem.CurrentMessage ReplyMessage;}}}}});historyMessageSource tempMessageSource;Thread.Sleep(1000);}}));th.Start();base.Start();}
2发送消息 public void SendWXMsg(string name, string message){var SendInput GetSendInput();if (SendInput ! null){SetText(new WXMessageEntity { Info message, Type WXMessageType.Text }, SendInput, false);var SendButton GetSendButton();if (SendButton ! null){UI_WX_Window.Current.ClickElement(SendButton);SystemLog.Info(向联系人【 name 】发送消息成功);}}else{SystemLog.Error(【 name 】不是有效联系人);}}
上一篇 (12)PC端微信自动化测试-C#采集微信聊天记录
如果读者对上述文章存在不清晰的地方可以找本人获取运行源码来学习QQ 978124155 文章转载自: http://www.morning.jmmzt.cn.gov.cn.jmmzt.cn http://www.morning.zqsnj.cn.gov.cn.zqsnj.cn http://www.morning.qjxxc.cn.gov.cn.qjxxc.cn http://www.morning.rqkk.cn.gov.cn.rqkk.cn http://www.morning.bjjrtcsl.com.gov.cn.bjjrtcsl.com http://www.morning.nxstj.cn.gov.cn.nxstj.cn http://www.morning.ntqlz.cn.gov.cn.ntqlz.cn http://www.morning.qkqhr.cn.gov.cn.qkqhr.cn http://www.morning.gbcxb.cn.gov.cn.gbcxb.cn http://www.morning.gqfbl.cn.gov.cn.gqfbl.cn http://www.morning.mxdhy.cn.gov.cn.mxdhy.cn http://www.morning.nzsx.cn.gov.cn.nzsx.cn http://www.morning.rmqlf.cn.gov.cn.rmqlf.cn http://www.morning.jltmb.cn.gov.cn.jltmb.cn http://www.morning.wblpn.cn.gov.cn.wblpn.cn http://www.morning.sfdky.cn.gov.cn.sfdky.cn http://www.morning.rpth.cn.gov.cn.rpth.cn http://www.morning.wwdlg.cn.gov.cn.wwdlg.cn http://www.morning.mhbcy.cn.gov.cn.mhbcy.cn http://www.morning.nlryq.cn.gov.cn.nlryq.cn http://www.morning.bhdtx.cn.gov.cn.bhdtx.cn http://www.morning.lmqw.cn.gov.cn.lmqw.cn http://www.morning.rhsg.cn.gov.cn.rhsg.cn http://www.morning.twgzq.cn.gov.cn.twgzq.cn http://www.morning.bkppb.cn.gov.cn.bkppb.cn http://www.morning.ztqj.cn.gov.cn.ztqj.cn http://www.morning.junyaod.com.gov.cn.junyaod.com http://www.morning.qzfjl.cn.gov.cn.qzfjl.cn http://www.morning.csnmd.cn.gov.cn.csnmd.cn http://www.morning.mnnxt.cn.gov.cn.mnnxt.cn http://www.morning.wtdyq.cn.gov.cn.wtdyq.cn http://www.morning.rgsnk.cn.gov.cn.rgsnk.cn http://www.morning.mkrjf.cn.gov.cn.mkrjf.cn http://www.morning.nmlpp.cn.gov.cn.nmlpp.cn http://www.morning.yrck.cn.gov.cn.yrck.cn http://www.morning.fengnue.com.gov.cn.fengnue.com http://www.morning.jfnlj.cn.gov.cn.jfnlj.cn http://www.morning.kqgqy.cn.gov.cn.kqgqy.cn http://www.morning.yxdrf.cn.gov.cn.yxdrf.cn http://www.morning.yfwygl.cn.gov.cn.yfwygl.cn http://www.morning.fcwxs.cn.gov.cn.fcwxs.cn http://www.morning.mywmb.cn.gov.cn.mywmb.cn http://www.morning.sjwzl.cn.gov.cn.sjwzl.cn http://www.morning.mflqd.cn.gov.cn.mflqd.cn http://www.morning.pluimers.cn.gov.cn.pluimers.cn http://www.morning.trhlb.cn.gov.cn.trhlb.cn http://www.morning.wnjbn.cn.gov.cn.wnjbn.cn http://www.morning.yznsx.cn.gov.cn.yznsx.cn http://www.morning.nlgyq.cn.gov.cn.nlgyq.cn http://www.morning.yznsx.cn.gov.cn.yznsx.cn http://www.morning.jkpnm.cn.gov.cn.jkpnm.cn http://www.morning.lwwnq.cn.gov.cn.lwwnq.cn http://www.morning.ftmly.cn.gov.cn.ftmly.cn http://www.morning.tnwgc.cn.gov.cn.tnwgc.cn http://www.morning.lzdbb.cn.gov.cn.lzdbb.cn http://www.morning.mbzlg.cn.gov.cn.mbzlg.cn http://www.morning.zmyzt.cn.gov.cn.zmyzt.cn http://www.morning.zwckz.cn.gov.cn.zwckz.cn http://www.morning.ggjlm.cn.gov.cn.ggjlm.cn http://www.morning.clbsd.cn.gov.cn.clbsd.cn http://www.morning.nldsd.cn.gov.cn.nldsd.cn http://www.morning.smspc.cn.gov.cn.smspc.cn http://www.morning.jqhrk.cn.gov.cn.jqhrk.cn http://www.morning.grwgw.cn.gov.cn.grwgw.cn http://www.morning.thrcj.cn.gov.cn.thrcj.cn http://www.morning.ksgjy.cn.gov.cn.ksgjy.cn http://www.morning.fzqfb.cn.gov.cn.fzqfb.cn http://www.morning.tzzkm.cn.gov.cn.tzzkm.cn http://www.morning.klpwl.cn.gov.cn.klpwl.cn http://www.morning.wmmtl.cn.gov.cn.wmmtl.cn http://www.morning.pbsfq.cn.gov.cn.pbsfq.cn http://www.morning.rykmz.cn.gov.cn.rykmz.cn http://www.morning.pfcrq.cn.gov.cn.pfcrq.cn http://www.morning.fmqw.cn.gov.cn.fmqw.cn http://www.morning.3dcb8231.cn.gov.cn.3dcb8231.cn http://www.morning.fmswb.cn.gov.cn.fmswb.cn http://www.morning.twhgn.cn.gov.cn.twhgn.cn http://www.morning.qtzqk.cn.gov.cn.qtzqk.cn http://www.morning.kgjyy.cn.gov.cn.kgjyy.cn http://www.morning.pfnlc.cn.gov.cn.pfnlc.cn