背景需求:
我想用UIBOT自动模拟鼠标,登录每位老师的账户,进入评价区域,自动选择7次“满意”,输入1次“无”,然后提交。
C++
Dim objExcelWorkBook,arrayRet,iRet,temp,iPID,hWeb,dictRet,X
objExcelWorkBook = Excel.OpenExcel('''C:\Users\jg2yXRZ\OneDrive\桌面\20230223进修编号10月刷分.xlsx''',true,"Excel","","")
区域=Excel.ReadRange(objExcelWorkBook,"Sheet1","B11:D12",true)
行=UBound(区域)
TracePrint(行)
For i = 0 To 行 step 1
hWeb = WebBrowser.Create("chrome","https://qxgl.21shte.net/portal/login.html",30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"sBrowserPath":"","sStartArgs":""})
Window.Show(@ui"窗口_qxgl.21shte.net/portal/login.html-GoogleChrome","max")
Delay(1000)
#icon("@res:6cf43e20-0167-11ef-b91d-9f2fd80b9e8a.png")
Image.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"qxgl.21shte.net/portal/login.html - Google Chrome","app":"chrome"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"6cf43e20-0167-11ef-b91d-9f2fd80b9e8a.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)
TracePrint(区域[i])
编号 = 区域[i][1]
密码 = 区域[i][2]
Keyboard.InputText(@ui"块级元素<div>_师训号/用户名/身份证号码",区域[i][1],true,20,10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 500, "bSetForeground": true, "sSimulate": "message", "bValidate": false, "bClickBeforeInput": false})
Keyboard.InputText(@ui"输入控件<input>1",区域[i][2],true,20,10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 500, "bSetForeground": true, "sSimulate": "message", "bValidate": false, "bClickBeforeInput": false})
Mouse.Drag(831, 555, 1120, 557, "left", [],{"iDelayAfter": 300, "iDelayBefore": 200})
#icon("@res:45c72f60-009a-11ef-9784-0942ecf9a81b.png")
Image.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"CAS – 统一身份认证 - Google Chrome","app":"chrome"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"45c72f60-009a-11ef-9784-0942ecf9a81b.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:c439db40-0167-11ef-b91d-9f2fd80b9e8a.png")
Image.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"上海市区级教师教育管理平台 - Google Chrome","app":"chrome"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"c439db40-0167-11ef-b91d-9f2fd80b9e8a.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:d017e1a0-0167-11ef-b91d-9f2fd80b9e8a.png")
Image.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"上海市区级教师教育管理平台 - Google Chrome","app":"chrome"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"d017e1a0-0167-11ef-b91d-9f2fd80b9e8a.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)
Mouse.Wheel(2,"down", [],{"iDelayAfter":300, "iDelayBefore":200})
X = 518
For Y = 233 To 903 step 110
Mouse.Move(X, Y, false,{"iDelayAfter": 300, "iDelayBefore": 200})
Mouse.Click("left", "click", [],{"iDelayAfter": 300, "iDelayBefore": 300})
Next
Keyboard.InputText(@ui"多行文本<textarea>","无",true,20,10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 500, "bSetForeground": true, "sSimulate": "message", "bValidate": false, "bClickBeforeInput": false})
Mouse.Wheel(2,"down", [],{"iDelayAfter":300, "iDelayBefore":200})
#icon("@res:300b8570-0169-11ef-b91d-9f2fd80b9e8a.png")
Image.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"上海市区级教师教育管理平台 - Google Chrome","app":"chrome"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"300b8570-0169-11ef-b91d-9f2fd80b9e8a.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)
#icon("@res:63afe380-0169-11ef-b91d-9f2fd80b9e8a.png")
Image.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"上海市区级教师教育管理平台 - Google Chrome","app":"chrome"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"63afe380-0169-11ef-b91d-9f2fd80b9e8a.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:7012aa40-0169-11ef-b91d-9f2fd80b9e8a.png")
Image.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"上海市区级教师教育管理平台 - Google Chrome","app":"chrome"}]},{"x": 0, "y": 0, "width": 0, "height": 0},@res"7012aa40-0169-11ef-b91d-9f2fd80b9e8a.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)
Next
Excel.CloseExcel(objExcelWorkBook,true)
视频展示:
有个人数据信息,需要用EDIUS打码,视频后续上传。