作品展示:
一、背景需求:
本学期制作了 “育儿知识(家园小报)”合并A4内容
【办公类-22-08】周计划系列(4)“育儿知识(家园小报)“ (2024年调整版本)-CSDN博客文章浏览阅读977次,点赞25次,收藏12次。【办公类-22-08】周计划系列(4)“育儿知识(家园小报)“ (2024年调整版本)https://blog.csdn.net/reasonsummer/article/details/136284529
育儿知识(家园小报)上传的UIBOT设置与“信息窗主题知识)”是一样的,但文件名中提取标题的字符位置略有不同。
二、制作过程:——批量上传“育儿知识”
1、工具准备
二、代码解析
Dim sRet,sName,arrayRet,iRet,标题,bRet,第,temp,),横,时间1,尾,(,杠,年月,上传日期
Rem 进入教育教学页面 页面90%
Rem 获取所有图片名称
图片名称=File.DirFileOrFolder('''D:\test\02办公类\91周计划4份_2024年中4班\03 育儿知识\05jpg上传''',"fileandfolder",{"hasPath":true})
TracePrint(图片名称)
长度=Len(图片名称)
// TracePrint(长度)
Rem 提取每个路径的内容
For 份 = 0 To 长度-1 step 1
TracePrint(份)
Mouse.Action(@ui"链接<a>_新建","left","click",10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": false})
Rem 写入图片唯一路径
Mouse.Action(@ui"内联框架<iframe>","left","click",10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": false})
Mouse.Action(@ui"窗口3","left","click",10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": false})
Keyboard.Input(图片名称[份],{"iDelayAfter": 100, "iDelayBefore": 100, "sSimulate": "message"})
Mouse.Action(@ui"窗口_打开(O)","left","click",10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": false})
Delay(1000)
Rem 获取标题 2024年2月 育儿知识
// TracePrint(第)
年=InStr(图片名称[份]," 2024",1,false)
月=InStr(图片名称[份],"月",1,false)
// TracePrint())
年月=SubStr(图片名称[份],年+1,月-年+1-1)
// TracePrint(年月)
标题 = 年月+" 育儿知识"
TracePrint(标题)
年2=SubStr(图片名称[份],年+1,年+1)
时间 = 年月+"01日"
If 时间="2024年02月01日"
时间 = 年月+"19日"
End If
TracePrint(时间)
// TracePrint(()
// TracePrint(杠)
Keyboard.InputText(@ui"输入控件<input>_2023-04-3015:35",时间,true,20,10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 500, "bSetForeground": true, "sSimulate": "message", "bValidate": false, "bClickBeforeInput": false})
Keyboard.InputText(@ui"输入控件<input>",标题,true,20,10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 500, "bSetForeground": true, "sSimulate": "message", "bValidate": false, "bClickBeforeInput": false})
Delay(1000)
Mouse.Action(@ui"链接<a>_发布","left","click",10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": false})
Mouse.Action(@ui"按钮<button>_确定","left","click",10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate", "bMoveSmoothly": false})
Delay(10000)
Next
三、运行展示:
20240302Uibot 批量上传图片(育儿知识家园小报)
上传结果,发布时间都是选择每月第一天(2月是按照实际开学日计算)
感悟:
花了4分半钟上传7张主题说明图片,高效快捷,精准。