最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
python实现网易邮箱邮件阅读和删除的辅助小脚本代码示例
时间:2021-03-01 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下python实现网易邮箱邮件阅读和删除的辅助小脚本代码示例,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
在Windows下的网易邮箱大师客户端中,阅读邮件时,可以使用快捷键Delete删除邮件,然后自动跳到下一封,如果再按一次Delete键,再跳到下一封。为了迅速的阅读邮件,同时删除没有必要的邮件,特地写了如下脚本,自用同时放出来共享。
问题:
1. 如上图,积累太多未读邮件,原因是每天邮件太多,根本看不完,数量马上到上限了;
2. 想看到每封邮件;
3. 邮件有时内容太过鸡肋,属于知晓型即可,看完即可删除;
4. 大多数看完就要删除,一个个删除太麻烦;
一句话,需要自动删除看完之后觉得没有用处的邮件。
一个解决方案:
见如下代码
import win32api import time def fast_email_reading_and_delete(vk_code: int) -> None: """ Virtual Key Code reference: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes """ print("Running, please switch to the software you are using within 3 seconds!") time.sleep(3) # use this 3 seconds to switch to the software you use, for example Netease email client count = 0 while True: win32api.keybd_event(int(vk_code), 0, 0, 0) count += 1 if count % 30 == 0: # refresh every 30 seconds to get more email from Netease email server win32api.keybd_event(int(0x71), 0, 0, 0) # 0x71 is F2 refresh, int is 113 time.sleep(1) # mail reading time # press space key or right arrow would halt the delete process. 0x20 spacekey 0x27 right arrow key if win32api.GetAsyncKeyState(int(0x20)) or win32api.GetAsyncKeyState(int(0x27)): while True: time.sleep(0.5) if win32api.GetAsyncKeyState(int(0x20)) or win32api.GetAsyncKeyState(int(0x27)): break if __name__ == '__main__': fast_email_reading_and_delete(0x2E) # 0x2E is DEL key, equivalent int is 46
理论上讲,上述脚本适用于任何有DEL快捷键功能的软件,注意不要把自己的东西搞砸了,自动删除时间是1秒。
相关文章
- Golang ProtoBuf的基本语法详解 10-20
- Python识别MySQL中的冗余索引解析 10-20
- Python+Pygame绘制小球代码展示 10-18
- Python中的数据精度问题介绍 10-18
- Python随机值生成的常用方法介绍 10-18
- python3解压缩.gz文件分析 09-27