• 模拟键盘和复制文件


    模拟键盘和复制文件

    from pykeyboard import PyKeyboard
    import time
    import glob
    import os
    import shutil
    import threading
    
    def key_click_f1(t=1):
        k = PyKeyboard()
        while True:
            print('点击F1')
            k.tap_key(k.function_keys[1]) # 点击功能键F5
            time.sleep(1)
    
    def copy_file(files_map_list,t=30):
        while True:
            for file_map in files_map_list:
                source_dir, aim_dir, file_type = file_map
                glob_source_path = os.path.join(source_dir,'*.{}'.format(file_type))
                glob_aim_path = os.path.join(aim_dir,'*.{}'.format(file_type))
                source_file_paths = glob.glob(glob_source_path)
                aim_file_paths = glob.glob(glob_aim_path)
    
                if not aim_file_paths:
                    print(files_map_list)
                    for source_path in source_file_paths:
                        file_name = os.path.basename(source_path)
                        aim_path = os.path.join(aim_dir,file_name)
                        shutil.copyfile(source_path,aim_path)
            time.sleep(1)
    
    f1_t = threading.Thread(target=key_click_f1,args=(2,),daemon=True)
    
    args_map = [
        [r'C:UsersWangLinDownloads',r'D:ccc', 'png'],
        ]
    copy_t = threading.Thread(target=copy_file,args=(args_map,),daemon=True)
    
    t_list = []
    # t_list.append(f1_t)
    t_list.append(copy_t)
    
    for t in t_list:
        t.start()
    for t in t_list:
        t.join()
    
  • 相关阅读:
    unity 反编译 step2 dll -->reflector
    unity 反编译 step1 disUnity
    rpg
    cmake使用
    linux mysqld的启动过程
    unity内存加载和释放
    Linux下MySql数据库常用操作
    MySQL主从复制与读写分离(非原创,谢绝膜拜)
    linux下IPTABLES配置详解
    linux下查看端口的占用情况
  • 原文地址:https://www.cnblogs.com/pythonwl/p/14898916.html
Copyright © 2020-2023  润新知