前言
在之前网课的一些奇闻异事可以看出,我是很喜欢上网课摸鱼,摆烂,睡懒觉(各种叠buff)的人,尤其是睡懒觉最为严重,因此也招惹了很多老师,想着自己也要努力改正,但在改正的这个空档期,写个程序在早上自己自动进入会议吧。
试着在网上找轮子使用,但个个bug多多,如FuckTencentMeeting,虽然可以运行但是为了改腾讯会议的安装路径以及改坐标(文件里坐标写死),折腾了好久也无果,后来看到pymouse和pykeyboard才知可以自己写的啊。
程序
原本写的没有注释的,发到博客上就加点注释吧。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
   |  from pykeyboard import * from pymouse import * import time import schedule as sch import csv
  m = PyMouse()   k = PyKeyboard()  
 
  class TecentMeeting:     def __init__(self, roomid, passwd):         self.roomid = roomid         self.passwd = passwd
      def survey(self):                  print("五秒后开始确定位置……")         time.sleep(5)
          print("请对准第1个位置: 加入")         time.sleep(4)         self.location1 = list(m.position())         time.sleep(4)
          print("请对准第2个位置:会议号")         time.sleep(6)         self.location2 = list(m.position())
          print("请对准第3个位置:关闭摄像头")         time.sleep(5)         self.location3 = list(m.position())
          print("请对准第4个位置:加入")         time.sleep(5)         self.location4 = list(m.position())
          print("请对准第5个位置:密码")         time.sleep(4)         self.location5 = list(m.position())
          print("请对准第6个位置:加入")         time.sleep(4)         self.location6 = list(m.position())
          print("位置确定完成!\n")
      def run(self):         m.click(self.location1[0], self.location1[1])         time.sleep(2)         m.click(self.location2[0], self.location2[1])         time.sleep(2)         k.tap_key(k.backspace_key)         k.type_string(self.roomid)         time.sleep(2)         m.click(self.location3[0], self.location3[1])         time.sleep(2)         m.click(self.location4[0], self.location4[1])         time.sleep(2)         m.click(self.location5[0], self.location5[1])         time.sleep(2)         if self.passwd != '':               k.type_string(self.passwd)         time.sleep(2)         m.click(self.location6[0], self.location6[1])
 
  if __name__ == "__main__":     roomid = input("请输入会议号:")     passwd = input("请输入房间密码(无请留空):")
      teme = TecentMeeting(roomid, passwd)     teme.survey()  
      print("请关闭子层窗口,10秒后开始试运行……(运行时请勿移动App)")     time.sleep(10)
      teme.run()     print("试运行完成")
      runcom = input("坐标点是否需要重新获取?(y or n): ")     while runcom == "y":         teme.survey()         runcom = input("坐标点是否需要重新获取?(y or n): ")
      runtime = input("输入运行时间(小时:分钟): ")     sch.every().day.at(runtime).do(teme.run)
      print("开始等待……(执行后请Ctrl-C终止程序)")       try:         while True:             sch.run_pending()             time.sleep(60)     except:         pass
 
  | 
 
#仓库及Exe
Exe可执行文件(Windows): https://pan.nikoblog.top/api/raw/?path=/工具/AutoTenMeeting.exe
Github仓库: AutoTenMeeting