吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3401|回复: 19
收起左侧

[Python 转载] 微信接收文件自动分类整理(已打包exe)

[复制链接]
youpc529 发表于 2021-7-7 15:12
一、背景
https://www.52pojie.cn/forum.php ... ypeid%26typeid%3D29
二、运行界面如下,简单随便,懒得
image.png
三、教程
1、右键,以管理员身份运行;
2、依次输入3个路径,微信应用程序、微信接收文件夹以及微信整理后的文件夹,如下图,
image.png
3、输入微信程序的版本名称,如下图,
微信图片_20210707144624.png
四、打包的链接
链接: https://pan.baidu.com/s/1wn6f8z4WlAHOpZw-0YswPA 提取码: n4cq
密码:52pojie
五、代码
[Python] 纯文本查看 复制代码
from pywinauto import Desktop, Application
import pyautogui
import re
import os
import shutil

data_dic={}
folder_name=[]
file_name=[]
os.environ.update({"__COMPAT_LAYER":"RUnAsInvoker"})
wx_pro_path=input('输入微信程序路径并按回车键:')
old_file_path=input('输入微信文件路径并按回车键:')
folder_path=input('创建微信整理文件,输入路径并按回车键:')
wx_title=input('输入微信版本并按回车键:')

app = Application(backend='uia').start(wx_pro_path)

win_main_Dialog = Desktop(backend='uia').window(title=wx_title)

wj=win_main_Dialog.window(title='微信文件')
wj.click_input()

win_main_Dialog = Desktop(backend='uia').window(title='微信文件')
wj2=win_main_Dialog.child_window(title='全部')
wj2.click_input()

for i in range(6):
    wj2.type_keys("{TAB}")

wj2.type_keys("{ENTER}")
for i in range(3):
    wj2.type_keys("{DOWN}")
wj2.type_keys("{ENTER}")


for i in range(11):
    wj2.type_keys("{TAB}")


def read_data():
    str_n='te'
    list_now=[]
    for i in range(1,8):
        fi_n=win_main_Dialog.children()[1].children()[2].children()[1].children()[1].children()[0].children()[0].children()[0].children()[0].children()[i].children()[0].children()[0].children()[1].children()[0].children()[0].children()[0].children()[0].window_text()
        fo_n=win_main_Dialog.children()[1].children()[2].children()[1].children()[1].children()[0].children()[0].children()[0].children()[0].children()[i].children()[0].children()[0].children()[1].children()[0].children()[1].children()[0].window_text()
        date_n=win_main_Dialog.children()[1].children()[2].children()[1].children()[1].children()[0].children()[0].children()[0].children()[0].children()[i].children()[0].children()[0].children()[1].children()[1].children()[0].children()[1].window_text()
        if fo_n[-3:] == '的聊天':
            fo_n=re.findall('与(.*)的聊天',fo_n)[0]
        else:
            number=re.search(u"\|(.*?)",fo_n).span()[1]+1
            fo_n=fo_n[number:]
        list_now.append(fi_n.strip()[:2])
        str_n+=fi_n.strip()[:2]
        file_name.append(fi_n.strip())
        folder_name.append(fo_n.strip())
    
    return list_now,str_n
def press_down(down_num):
    for i in range(down_num):
        pyautogui.press('down')


str_b=read_data()
press_down(8)
press_down(7)
str_n=read_data()
print(11)
while str_b!=str_n:
    str_b=str_n
    press_down(7)
    str_n=read_data()
    
print('data')
for i in range(len(file_name)):
    if file_name[i] in data_dic:
        data_dic[file_name[i]]+=[folder_name[i]]
    else:
        data_dic[file_name[i]]=[folder_name[i]]

for i in set(folder_name):
    try:
        os.makedirs(os.path.join(folder_path,i))
    except OSError:
        print(i)
        
print('folder')

for root,dirs,files in os.walk(old_file_path):
    for file in files:
        old_path=os.path.join(root,file)
        f_name=os.path.splitext(file)[0]
        f_name_s=os.path.splitext(file)[1]
        while f_name[-3:]=='(1)':
            f_name=f_name[0:-3]
            
        try:
            des_path_list=data_dic[f_name+f_name_s]
            for j in des_path_list:
                des_path=os.path.join(folder_path,j,file)
                shutil.copyfile(old_path,des_path)
        except KeyError:
            print('wu')
            print(os.path.join(root,file))
        except OSError:
            print('os')
            print(os.path.join(root,file))

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
ytkevin0908 + 1 + 1 我很赞同!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

广州快乐神 发表于 2021-7-7 17:36
                              太高级了                       
xy6538 发表于 2021-7-7 19:09
pywinauto.findwindows.ElementNotFoundError: {'title': '微信 3.3.0.93', 'top_level_only': True, 'backend': 'uia'}
key_user 发表于 2021-7-7 15:29
wo115588 发表于 2021-7-7 15:32
正好需要
舒克贝塔皮皮鲁 发表于 2021-7-7 15:47
微信版本号 3.3.0.93  按步骤运行完后闪退
起到凌晨 发表于 2021-7-7 15:49
3.3.0.93 微信版本报错,瞬间消失。
独特丶小白 发表于 2021-7-7 15:51
很实用,。谢谢
blindcat 发表于 2021-7-7 16:11
有点儿意思
wujiLINGMAO 发表于 2021-7-7 16:53
不错   感谢楼主
原点的守候 发表于 2021-7-7 17:11
感谢分享
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-13 00:53

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表