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

Method DownloadFiles

wxauto/wxauto.py:821–856  ·  view source on GitHub ↗

开始下载文件 Args: who ( str ):聊天名称 amount ( num ):下载的文件数量限制。 deadline ( str ):截止日期限制。 size ( str ):文件大小限制。 Returns: result ( bool ):下载是否成功

(self, who, amount, deadline=None, size=None)

Source from the content-addressed store, hash-verified

819 raise TargetNotFoundError(f'未查询到目标:{who}')
820
821 def DownloadFiles(self, who, amount, deadline=None, size=None):
822 '''开始下载文件
823
824 Args:
825 who ( str ):聊天名称
826 amount ( num ):下载的文件数量限制。
827 deadline ( str ):截止日期限制。
828 size ( str ):文件大小限制。
829
830 Returns:
831 result ( bool ):下载是否成功
832
833 '''
834 self._show()
835 itemlist = self.GetSessionList()
836 if who in itemlist:
837 self.item = self.SessionBox.ListItemControl(Name=who)
838 self.item.Click(simulateMove=False)
839 else:
840 wxlog.debug(f'未查询到目标:{who}')
841 itemfileslist = []
842
843 item = self.SessionBox.ListControl(Name='', searchDepth=7).GetParentControl()
844 item = item.GetNextSiblingControl()
845 item = item.ListControl(Name='', searchDepth=5).GetChildren()
846 del item[0]
847
848 for i in range(amount):
849 try:
850
851 itemfileslist.append(item[i].Name)
852 self.itemfiles = item[i]
853 self.itemfiles.Click()
854 time.sleep(0.5)
855 except:
856 pass
857
858 def Close(self):
859 self._show()

Callers

nothing calls this directly

Calls 8

_showMethod · 0.95
GetSessionListMethod · 0.95
ListItemControlMethod · 0.80
ClickMethod · 0.80
GetParentControlMethod · 0.80
ListControlMethod · 0.80
GetNextSiblingControlMethod · 0.80
GetChildrenMethod · 0.45

Tested by

no test coverage detected