1. 程式人生 > 其它 >UIBOT 實現滑鼠點選計數,流程判斷

UIBOT 實現滑鼠點選計數,流程判斷

Dim bRet = ""
Dim objRet = ""
Dim arrSet = ""
Dim arrayRet = ""
Dim objExcelWorkBook = ""
//--遺漏的lost
// objExcelWorkBook = Excel.OpenExcel('''C:\Users\Asus\Desktop\遺漏的.xlsx''',False,"WPS","","")
// objRet = Excel.ReadCell(objExcelWorkBook,"sheet1","A1:A75")
//usuall 
objExcelWorkBook = Excel.OpenExcel('''C:\Users\Asus\Documents\Tencent Files\1778296894\FileRecv\合併3.xlsx
''',False,"WPS","","") objRet = Excel.ReadCell(objExcelWorkBook,"sheet1","A25379:A31897")//A21625:A30000 //A18362---A20296A22440--A24566 //arrayRet = Excel.ReadRange(objExcelWorkBook,"Sheet1","D2:D96") //arrayRet = Excel.ReadColumn(objExcelWorkBook,"Sheet1","D9") Excel.CloseExcel(objExcelWorkBook,True) arrSet = Set.ToArray(objRet) Dim count
= 0 //定義迴圈重新整理頁面 For Each id_no In arrSet If id_no = "" //定義迴圈重新整理頁面 Continue Else count = count + 1 If count Mod 30 <> 0 #icon("@res:piuqo5gi-1vu1-moc0-9k5o-3m07us5kf22k.png") Keyboard.InputText({"wnd":[{"cls":"Chrome_WidgetWin_1
","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"INPUT","id":"c4_wlno"}]},id_no,True,20,10000,{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":500,"bSetForeground":True,"sSimulate":"message","bValidate":True,"bClickBeforeInput":True}) #icon("@res:b2dlcs8v-m66h-p9tf-s6ca-mm3609mj6o80.png") UiElement.SetSelect({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"SELECT"}]},"所有","text",{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":200}) #icon("@res:jjjp4ipl-lci5-ujri-risl-0bopeeh30gk5.png") Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"BUTTON","parentid":"filterMoreDiv"}]},"left","click",10000,{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":400,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) Delay(4000) #icon("@res:i8tqf393-ff8h-1bof-arhc-08u532i88nqe.png") bRet = UiElement.Exists({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","parentid":"dwData","aaname":"編輯","tableRow":"2"}]},{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":200}) If bRet = True TracePrint("11修改成功~~~~:"&id_no) #icon("@res:juoaoona-28j5-59pf-ajo2-veastu3ivnft.png") Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","parentid":"dwData","aaname":"編輯","tableRow":"2"}]},"left","click",5000,{"bContinueOnError":True,"iDelayAfter":200,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) #icon("@res:pv30l4hu-eg79-g12u-50nu-sh7bad825umr.png") bRet1 = UiElement.Exists({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"BUTTON","parentid":"c1main","aaname":"完成"}]},{"bContinueOnError":True,"iDelayAfter":200,"iDelayBefore":200}) If bRet1 = True #icon("@res:a7dfde5i-h2al-e28f-rbnb-8ir8hht37ccu.png") Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"BUTTON","parentid":"c1main","aaname":"完成"}]},"left","click",5000,{"bContinueOnError":True,"iDelayAfter":200,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) #icon("@res:dcoonj88-fde3-pbkp-ulev-7699f2sorgp1.png") Keyboard.InputText({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"TEXTAREA"}]},"您的公交卡已製作完畢。",True,20,6000,{"bContinueOnError":True,"iDelayAfter":200,"iDelayBefore":200,"bSetForeground":True,"sSimulate":"message","bValidate":False,"bClickBeforeInput":False}) // dim count = 0 // #icon("@res:9bujp12u-6sna-o33f-5amf-u9dkvtca9ors.png") // bRet2 = UiElement.Exists({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","aaname":"確定完成"}]},{"bContinueOnError":False,"iDelayAfter":300,"iDelayBefore":200}) // If bRet2 = true #icon("@res:k23ajud4-fnoh-4v89-s542-255ch9hig1id.png") Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","aaname":"確定完成"}]},"left","click",10000,{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) //end if TracePrint("22修改成功~~~~:"&id_no) Delay(9000) // #icon("@res:s2tep3an-ngdr-33bt-ulu7-pfq1sfp96hmh.png") // Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"BUTTON","parentid":"filterMoreDiv"}]},"left","click",10000,{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) // Delay(2000) Else TracePrint("33原本是已經點選完成狀態!!:"&id_no) #icon("@res:ueqrsmgd-r8g1-33ov-dqtk-pp8gif7iricu.png") Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"BUTTON","parentid":"c1main","aaname":"關閉"}]},"left","click",10000,{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) Continue End If Else TracePrint("44原本就是修改成功的~~~~:"&id_no) Delay(2000) Continue End If Else #icon("@res:eevlteq7-m0n2-337u-m7vp-bclso23dfc1s.png") Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"A","parentid":"mainMenuBar","aaname":"65週歲及以上老年公交卡"}]},"left","click",10000,{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) Delay(10000) #icon("@res:gcfnbcik-6dga-o4ml-62fv-uk71ngjet03b.png") bRet3 = UiElement.Exists({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"BUTTON","idx":1}]},{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":300}) If bRet3 = True #icon("@res:u8a5n4ep-qbrj-v6k6-0n1c-8asami8o1our.png") Mouse.Action({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"*","app":"chrome"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}],"html":[{"tag":"BUTTON","idx":1}]},"left","click",10000,{"bContinueOnError":True,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":True,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate","bMoveSmoothly":False}) Else Continue End If Continue End If End If Next CollectGarbage

 計數

Dim count = 0 //定義迴圈重新整理頁面
For Each id_no In arrSet
    If id_no = ""
        //定義迴圈重新整理頁面
        Continue
    Else
        count = count + 1                    
        If  count Mod 30 <> 0
        end if
next