作品展示
背景需求
培训机构提供了两个理论学习素材
问题:
1、电子稿:打印页数很多,按章节,题型混在一起的,只有答案,没有说明,
2、APP版,操作方便,有错题集,也只有答案,没有解析说明。但是APP只能一道题一道题看,不如纸质的可宏观看所有题。
很多老师问我有没有分类(判断、多选、单选)的PDF打印文件?
思路:
由于是手机版的APP,为了将题目文字读取出来。
我使用Uibot,读取屏幕内容的功能,将题目、选项、答案,逐一写入EXCLE内
以下演示“Uibot读取育婴师高级-多选题”的代码
多选题一共344题
代码解析:
Dim sText,objExcelWorkBook,文字
objExcelWorkBook = Excel.OpenExcel('''C:\Users\jg2yXRZ\OneDrive\桌面\多选题.xlsx''',true,"Excel","","")
For i = 1 To 344 step 1
#icon("@res:d51aa1f0-f272-11ee-9066-536d8ee172e9.png")
Image.Click({"wnd":[{"cls":"StartupDui","title":"多屏协同","app":"HwMirror"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"d51aa1f0-f272-11ee-9066-536d8ee172e9.png",0.9,"left","click",10000, {"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate","sMatchType":"GrayMatch", "iSerialNo": 1})
Delay(1000)
#icon("@res:bce68990-f273-11ee-9066-536d8ee172e9.png")
Image.Click({"wnd":[{"cls":"StartupDui","title":"多屏协同","app":"HwMirror"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"bce68990-f273-11ee-9066-536d8ee172e9.png",0.9,"left","click",10000, {"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate","sMatchType":"GrayMatch", "iSerialNo": 1})
Delay(1000)
文字=LocalOCR.ScreenOCR(@ui"窗口_FolderView",{"x":1457,"y":349,"width":390,"height":500},"SceneText",10000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":true})
Delay(1000)
TracePrint($PrevResult)
Excel.WriteCell(objExcelWorkBook,"Sheet1","A"&i,文字,false)
Delay(1000)
#icon("@res:7f4cdaf0-f276-11ee-9066-536d8ee172e9.png")
Image.Click({"wnd":[{"cls":"StartupDui","title":"多屏协同","app":"HwMirror"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"7f4cdaf0-f276-11ee-9066-536d8ee172e9.png",0.9,"left","click",10000, {"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 200, "bSetForeground": true, "sCursorPosition": "Center", "iCursorOffsetX": 0, "iCursorOffsetY": 0, "sKeyModifiers": [],"sSimulate": "simulate","sMatchType":"GrayMatch", "iSerialNo": 1})
Delay(2000)
Next
Excel.Save(objExcelWorkBook)
视频展示:
344题一共读取了1小时24分钟(因为中间有很多的延迟时间,如果不设置延迟,会更快
<iframe allowfullscreen="true" data-mediaembed="csdn" frameborder="0" id="afjPHoY4-1712455272665" src="https://live.csdn.net/v/embed/376698"></iframe>uibot读取育婴师多选题344(84分钟)
)
EXCEL原始状态
EXCEL内容整理
1、拆分序号:")"为分割点
先把题目合并
删除CDE列内容
B列题目完整了、内容都在B列上
2、重新调整序号
3、拆分空格:选中B列,以“ 。 ”句号为分割点
手动加句号,很费时间(1个小时,添加句号)
初步筛选了题目(无句号)和选项(包括选项和答案)
用了很长时间进行验证,修改ABCD答案,最后把答案整理好了。
后续要对选项进行空格切片
删掉ABCD
花了大量时间,一道题一道题核对题目,选项,说多了都是泪
选项前面,插入列(A -E)
57题目是(A-F)
112题目是(A-D)
最后的效果
标签:536d8ee172e9,题目,21,9066,11ee,res,育婴师,多选题,png From: https://blog.csdn.net/reasonsummer/article/details/137420345