|
小工具-自动填写钉钉工作日志
日志内容为上一次填写的日志,提交方式为定时晚上8点提交,期间可以自由修改日志内容,主要功能是防止忘记填写日志
注:
需提前登录钉钉
钉钉版本为:7.6.0-Release.70310805
https://dtapp-pub.dingtalk.com/d ... v7.5.30.5179102.exe
[Python] [color=rgb(51, 102, 153) !important]纯文本查看 [color=rgb(51, 102, 153) !important]复制代码
[backcolor=rgb(27, 36, 38) !important][color=rgb(255, 255, 255) !important][color=#ffffff !important] ?
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
| 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 |
|
|