介绍
小编给大家分享一下如何使用Python实现企业微信的自动打卡功能,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获、下面让我们一起去了解一下吧!
上下班打卡是程序员最讨厌的东西,更讨厌的是设置了连上指定wifi打卡。
手机上有一些定时机器人之类的应用,经过实际测试,全军覆没,没一个可以活着走到启动企业微信的这一步,所以还是靠自己吧。
下面就通过Python程序来实现自动打卡,原理很简单,用Python设置定时任务,然后通过亚行操作手机,完成打卡。
1,准备工作
,安装了Python,亚行驱动(安装方式及下载地址见之前文章)的电脑一台;常驻在公司的测试机一台,数据线一条。
b,将手机通过数据线连接电脑,打开开发者选项中的允许USB调试,然后命令行运行亚行设备来测试下是否能显示设备,好则准备工作完毕。
2,实现代码
#本手机安装了企业微信分身,可以打两个人的卡 #,编码:utf - 8 import 操作系统 import 系统 import 时间 import 时间表 import 请求 def 单击(): ,#打第一个卡 ,os.system (& # 39; adb  shell input keyevent 82 & # 39;) #点亮屏幕 ,time . sleep (1) ,os.system (& # 39; adb  shell input keyevent 3 & # 39;) #单击键,回到主页 ,time . sleep (1) ,os.system (& # 39; adb  shell input swipe , 500, 300, 300, 300 & # 39;) #左划屏幕 ,time . sleep (1) ,os.system (& # 39; adb  shell input swipe , 500, 300, 300, 300 & # 39;) #左划屏幕 ,time . sleep (2) ,os.system (& # 39; adb  shell input tap 920年,800年& # 39;)#点击企业微信 ,time . sleep (5) ,os.system (& # 39; adb  shell input tap 678年,1820年& # 39;) ,time . sleep (5) ,os.system (& # 39; adb  shell input tap 410年,330年& # 39;) ,time . sleep (10) ,os.system (& # 39; adb  shell input tap 540年,1340年& # 39;) ,time . sleep (5) ,#打第二个卡 ,os.system (& # 39; adb  shell input keyevent 3 & # 39;) ,time . sleep (1) ,os.system (& # 39; adb  shell input swipe , 500, 300, 300, 300 & # 39;) ,time . sleep (1) ,os.system (& # 39; adb  shell input swipe , 500, 300, 300, 300 & # 39;) ,time . sleep (2) ,os.system (& # 39; adb  shell input tap 660年,1100年& # 39;) ,time . sleep (5) ,os.system (& # 39; adb  shell input tap 678年,1820年& # 39;) ,time . sleep (5) ,os.system (& # 39; adb  shell input tap 410年,330年& # 39;) ,time . sleep (10) ,os.system (& # 39; adb  shell input tap 540年,1340年& # 39;) ,time . sleep (5) ,#推送消息给微信,此处可以删除,仅为通知=,url & # 39; http://wxmsg.dingliqc.com/send?msg=打卡成功,用户id=自己微信的uid # 39; ,requests.get (url) ,sys.exit () def main (): ,& # 39;& # 39;& # 39; ,主函数 ,& # 39;& # 39;& # 39; ,schedule.every () .day.at(& # 39; 18:03& # 39;),(点击) ,while 真正的: schedule.run_pending才能() time . sleep(3)才能 if __name__ ==, & # 39; __main__ # 39;: 之前,main () >关于代码中涉及到的坐标点,可以通过手机页面截的图,放到电脑里编辑图片来查看触摸点的坐标值,跟机型和分辨率有关,需要针对自己的手机调试,睡觉的时间根据手机性能,网络环境可以做优化,然后运行代码就行了。想后台运行的话
<代码>/b python startwork开始。py 代码>
当然,最重要的一点,电脑要保持24小时开的机,程序员不担心这个,因为真正的程序员从不关机。
以上是“如何使用Python实现企业微信的自动打卡功能”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
如何使用Python实现企业微信的自动打卡功能