MCPcopy
hub / github.com/cluic/wxauto / parse

Method parse

wxauto/elements.py:938–959  ·  view source on GitHub ↗

解析合并消息内容,当且仅当消息内容为合并转发的消息时有效

(self)

Source from the content-addressed store, hash-verified

936 raise FriendNotFoundError(f'未找到好友:{friend}')
937
938 def parse(self):
939 """解析合并消息内容,当且仅当消息内容为合并转发的消息时有效"""
940 wxlog.debug(f'解析合并消息内容:{self.sender} | {self.content}')
941 self._winobj._show()
942 headcontrol = [i for i in self.control.GetFirstChildControl().GetChildren() if i.ControlTypeName == 'ButtonControl'][0]
943 RollIntoView(self.chatbox.ListControl(), headcontrol, equal=True)
944 xbias = int(headcontrol.BoundingRectangle.width()*1.5)
945 headcontrol.Click(x=xbias, simulateMove=False)
946 chatrecordwnd = uia.WindowControl(ClassName='ChatRecordWnd', searchDepth=1)
947 msgitems = chatrecordwnd.ListControl().GetChildren()
948 msgs = []
949 for msgitem in msgitems:
950 textcontrols = [i for i in GetAllControl(msgitem) if i.ControlTypeName == 'TextControl']
951 who = textcontrols[0].Name
952 time = textcontrols[1].Name
953 try:
954 content = textcontrols[2].Name
955 except IndexError:
956 content = ''
957 msgs.append(([who, content, ParseWeChatTime(time)]))
958 chatrecordwnd.SendKeys('{Esc}')
959 return msgs
960
961
962

Callers

nothing calls this directly

Calls 11

RollIntoViewFunction · 0.85
GetAllControlFunction · 0.85
ParseWeChatTimeFunction · 0.85
GetFirstChildControlMethod · 0.80
ListControlMethod · 0.80
widthMethod · 0.80
ClickMethod · 0.80
WindowControlMethod · 0.80
SendKeysMethod · 0.80
_showMethod · 0.45
GetChildrenMethod · 0.45

Tested by

no test coverage detected