自动填写钉钉工作日志

小工具-自动填写钉钉工作日志

日志内容为上一次填写的日志,提交方式为定时晚上8点提交,期间可以自由修改日志内容,主要功能是防止忘记填写日志

注:
需提前登录钉钉
钉钉版本为:7.6.0-Release.70310805
https://dtapp-pub.dingtalk.com/dingtalk-desktop/win_installer/Release/DingTalk_v7.5.30.5179102.exe

import datetime
 
import uiautomation as uia
 
import win32gui
 
 
 
 
 
class DingTalk:
 
    VERSION: str = '7.6.0'
 
    lastmsgid: str = None
 
    listen: dict = dict()
 
    SessionItemList: list = []
 
    UiaAPI: uia.WindowControl = uia.WindowControl(ClassName='StandardFrame_DingTalk', Name='钉钉', searchDepth=1)
 
 
 
    def __init__(self, language='cn') -> None:
 
        self.language = language
 
        self._show()
 
 
 
        self.NavigationBox = self.UiaAPI.WindowControl(className='client_ding::NavigatorView', Name='DingTalk')
 
        self.A_Chat_Button = self.NavigationBox.ButtonControl(Name='消息')
 
        self.A_Workbench_Button = self.NavigationBox.ButtonControl(Name='工作台')
 
        self.A_Contacts_Button = self.NavigationBox.ButtonControl(Name='通讯录')
 
 
 
    def workbench_with(self, appname):
 
        # 打开工作台下的某个应用或组件
 
        self.A_Workbench_Button.Click()
 
        WebBrowserBox = self.UiaAPI.WindowControl(className='client_ding::WebBrowserView', AutomationId='browser_window')
 
        WebBrowserBox.CheckBoxControl(searchDepth=4, searchProperties={'FullDescription': '工作台', 'ClassName': "client_ding::WebTabButton"}).Click()
 
        WebBrowserBox.EditControl(Name='搜索应用和组件').SendKeys('{Ctrl}a' + appname + '{enter}')
 
        WebBrowserBox.TextControl(Name=appname).Click()
 
        return WebBrowserBox
 
 
 
    def writelog(self):
 
        window = self.workbench_with('日志')  # 打开日志
 
        window.TextControl(Name='').Click()
 
        window.TextControl(Name='导入上篇').Click()
 
        self.UiaAPI.ButtonControl(Name='确定').Click()
 
 
 
        window.TextControl(Name='发送到人').Click()
 
        window.WheelDown(wheelTimes=20, waitTime=0.1)
 
        if window.CheckBoxControl(Name='定时发送').GetTogglePattern().ToggleState == 0:
 
            window.CheckBoxControl(Name='定时发送').GetTogglePattern().Toggle()
 
        window.EditControl(searchDepth=12, Name='选择发送时间').Click()
 
        window.EditControl(searchDepth=10, Name='选择发送时间').SendKeys('{Ctrl}a' + datetime.datetime.now().strftime('%Y-%m-%d 20:00') + '{enter}')
 
        # window.ButtonControl(Name='提 交').Click()
 
        window.ButtonControl(Name='保 存').Click()
 
 
 
    def _show(self):
 
        self.HWND = win32gui.FindWindow('StandardFrame_DingTalk', None)
 
        win32gui.ShowWindow(self.HWND, 1)
 
        win32gui.SetWindowPos(self.HWND, -1, 0, 0, 0, 0, 3)
 
        win32gui.SetWindowPos(self.HWND, -2, 0, 0, 0, 0, 3)
 
        self.UiaAPI.SwitchToThisWindow()
 
 
 
 
 
ding = DingTalk()
 
ding.writelog()

成品:

https://reaper0s.lanzoue.com/ibFBQ27clcoj

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
评论 共15条

请登录后发表评论