溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Q語(yǔ)言 我的命令庫(kù)《通用找圖》之后臺(tái)找圖函數(shù)源碼

發(fā)布時(shí)間:2020-07-28 19:26:38 來(lái)源:網(wǎng)絡(luò) 閱讀:299 作者:鬼谷子2015 欄目:開發(fā)技術(shù)

'---------------------后臺(tái)找圖B-------------------------------------

Function 找圖B(pictname)
    //    后臺(tái)找圖
    Dim icoord, Xy
    iCoord = Plugin.Bkgnd.FindPic(Hwnd, 0, 0,Lib.通用.getwindow_X(Hwnd) - 1,Lib.通用.getwindow_Y(Hwnd) - 1, bmp_path & pictname, 0, 0.6)
    XY = Split(iCoord,"|")   
    找圖_intx= XY(0)   
    找圖_inty= XY(1)       
    If 找圖_intx >= 0 and 找圖_inty >= 0 Then 
        日志運(yùn)行內(nèi)容 = V_當(dāng)前程序 & "B-------------->找到pict:" & pictname&"("&找圖_intx&","&找圖_inty&")"
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
        找圖B=1
    Else 
        日志運(yùn)行內(nèi)容 = V_當(dāng)前程序 & "B未找到pict:" & pictname
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容) : TracePrint 日志運(yùn)行內(nèi)容
        找圖B=0          
    End If
End Function

Function 找圖點(diǎn)擊B(pictname, 偏移X, 偏移Y)
    Dim 返回值
    找圖點(diǎn)擊B=0
    返回值= 找圖B(pictname)
    If 返回值 > 0 Then 
        Call Plugin.Bkgnd.MoveTo(Hwnd, 找圖_intX + cint(偏移X), 找圖_intY + cint(偏移Y))
        Delay 50
        Call Plugin.Bkgnd.LeftClick(Hwnd, 找圖_intX+cint(偏移X), 找圖_intY+cint(偏移Y))
        日志運(yùn)行內(nèi)容 = V_當(dāng)前程序 & "B---------->點(diǎn)擊pict:" & pictname
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容          
        找圖點(diǎn)擊B = 1
    End If
End Function

Function 找多圖B(pictname)
    Dim I,返回值,pict
    找多圖B = 0
    找多圖_intX = -1
    找多圖_intY = -1
    pict = split(pictname, "|")
    For i = 0 To ubound(pict)
        返回值=找圖B (pict(i))
        If 返回值 > 0 Then 
            日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"找到:第" & cstr(i + 1) & "張pict:" & pict(i)
            Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
            找多圖_intX = 找圖_intX
            找多圖_intY = 找圖_intY                
            找多圖B=i+1
            Exit For
        End If
    Next
End Function

Function 找多圖點(diǎn)擊B(pictname, 偏移X, 偏移Y)
    Dim 返回值
    找多圖點(diǎn)擊B=0
    返回值= 找多圖B(pictname)
    If 返回值 > 0 Then 
        Call Plugin.Bkgnd.MoveTo(Hwnd, 找多圖_intX + cint(偏移X), 找多圖_intY + cint(偏移Y))
        Delay 50
        Call Plugin.Bkgnd.LeftClick(Hwnd, 找多圖_intX+cint(偏移X), 找多圖_intY+cint(偏移Y))
        日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"A------------->點(diǎn)擊pict:"&pictname    
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
        找多圖點(diǎn)擊B = 返回值
    End If
End Function

Function 等圖B(pictname)
    Dim 返回值    
    日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"B正在等待pict....:" & pictname
    Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
    等圖B=0
    等圖_intX = -1
    等圖_intY = -1
    For 10000
        返回值 = 找圖B(pictname)
        If 返回值 > 0 Then 
            日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"B------------->等到pict:" & pictname
            Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
            等圖_intX = 找圖_intX
            等圖_intY = 找圖_intY            
            等圖B=1
            Exit For
        End If
        Delay 500          
    Next
End Function

Function 等圖點(diǎn)擊B(pictname, 偏移X, 偏移Y)
    Dim 返回值
    日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"正在等待點(diǎn)擊pict....:" & pictname
    Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
    等圖點(diǎn)擊B = 0
    等圖_intX = -1
    等圖_intY = -1          
    For 10000
        返回值 = 找圖B(pictname)
        If 返回值 > 0 Then 
            等圖_intX = 找圖_intX 
            等圖_intY = 找圖_intY       
            Call Plugin.Bkgnd.MoveTo(Hwnd, 等圖_intX + cint(偏移X), 等圖_intY + cint(偏移Y))
            Delay 50
            Call Plugin.Bkgnd.LeftClick(Hwnd, 等圖_intX+cint(偏移X), 等圖_intY+cint(偏移Y))
            日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"B-------------->點(diǎn)擊pict:" & pictname
            Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
            等圖點(diǎn)擊B=1
            Exit For
        End If
        Delay 500            
    Next
End Function

Function 等多圖B(pictname)
    Dim 返回值
    等多圖B=0
    等多圖_intX = -1
    等多圖_intY = -1
    For 10000
        返回值=找多圖B(pictname)
        If 返回值 > 0 Then 
            等多圖B = 返回值
            等多圖_intX = 找多圖_intX
            等多圖_intY = 找多圖_intY
            Exit For
        End If
        日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"遍歷一次,未等到所有pict"
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
        Delay 500    
    Next
End Function

'---------------------后臺(tái)找圖BC---帶句柄-------------------------

Function 找圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
    //    后臺(tái)找圖,自帶句柄
    Dim icoord, Xy
    //    TracePrint bmp_path
    iCoord = Plugin.Bkgnd.FindPic(句柄,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y, bmp_path & pictname, 0, 0.6)
    XY = Split(iCoord,"|")   
    找圖_intx= XY(0)   
    找圖_inty= XY(1)       
    If 找圖_intx >= 0 and 找圖_inty >= 0 Then 
        日志運(yùn)行內(nèi)容 = V_當(dāng)前程序 & "C-------------->找到pict:" & pictname&"("&找圖_intx&","&找圖_inty&")"
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
        找圖BC=1
    Else 
        日志運(yùn)行內(nèi)容 = V_當(dāng)前程序 & "C未找到pict:" & pictname
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容) : TracePrint 日志運(yùn)行內(nèi)容
        找圖BC=0          
    End If
End Function

Function 找圖點(diǎn)擊BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y, 偏移X, 偏移Y)
    Dim 返回值
    找圖點(diǎn)擊BC=0
    返回值= 找圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
    If 返回值 > 0 Then 
        Call Plugin.Bkgnd.MoveTo(句柄, 找圖_intX + cint(偏移X), 找圖_intY + cint(偏移Y))
        Delay 50
        Call Plugin.Bkgnd.LeftClick(句柄, 找圖_intX+cint(偏移X), 找圖_intY+cint(偏移Y))
        日志運(yùn)行內(nèi)容 = V_當(dāng)前程序 & "C---------->點(diǎn)擊pict:" & pictname
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容          
        找圖點(diǎn)擊BC = 1
    End If
End Function

Function 找多圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
    Dim I,返回值,pict
    找多圖BC = 0
    找多圖_intX = -1
    找多圖_intY = -1
    pict = split(pictname, "|")
    For i = 0 To ubound(pict)
        返回值=找圖BC(句柄,pict(i),基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
        If 返回值 > 0 Then 
            日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"C找到:第" & cstr(i + 1) & "張pict:" & pict(i)
            Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
            找多圖_intX = 找圖_intX
            找多圖_intY = 找圖_intY                
            找多圖BC=i+1
            Exit For
        End If
    Next
End Function

Function 找多圖點(diǎn)擊BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y, 偏移X, 偏移Y)
    Dim 返回值
    找多圖點(diǎn)擊BC=0
    返回值= 找多圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
    If 返回值 > 0 Then 
        //                  Call Lib.窗口.彈出對(duì)話框(偏移X&"......", 1, "", 0)
        Call Plugin.Bkgnd.MoveTo(句柄, 找多圖_intX + cint(偏移X), 找多圖_intY + cint(偏移Y))
        Delay 50
        Call Plugin.Bkgnd.LeftClick(句柄, 找多圖_intX + cint(偏移X), 找多圖_intY + cint(偏移Y))
        日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"A------------->點(diǎn)擊pict:"&pictname    
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
        找多圖點(diǎn)擊BC = 返回值
    End If
End Function

Function 等圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
    Dim 返回值    
    日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"C正在等待pict....:" & pictname
    Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
    等圖BC=0
    等圖_intX = -1
    等圖_intY = -1
    For 10000
        返回值 = 找圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
        If 返回值 > 0 Then 
            日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"C------------->等到pict:" & pictname
            Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
            等圖_intX = 找圖_intX
            等圖_intY = 找圖_intY            
            等圖BC=1
            Exit For
        End If
        Delay 500          
    Next
End Function

Function 等多圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
    Dim 返回值
    等多圖BC=0
    等多圖_intX = -1
    等多圖_intY = -1
    For 10000
        返回值=找多圖BC(句柄,pictname,基準(zhǔn)起點(diǎn)X,基準(zhǔn)起點(diǎn)Y,基準(zhǔn)終點(diǎn)X,基準(zhǔn)終點(diǎn)Y)
        If 返回值 > 0 Then 
            等多圖BC = 返回值
            等多圖_intX = 找多圖_intX
            等多圖_intY = 找多圖_intY
            Exit For
        End If
        日志運(yùn)行內(nèi)容 =  V_當(dāng)前程序&"遍歷一次,未等到所有pict"
        Call Lib.通用.輸出日志(日志運(yùn)行內(nèi)容):TracePrint 日志運(yùn)行內(nèi)容
        Delay 500   
    Next
End Function

'-------------------------------------------

//以下為全局變量:
/
Hwnd:句柄
bmp_path:圖文件目錄
找圖_intx
找圖_inty
等圖_intX
等圖_intY
找多圖_intX
找多圖_intY
等多圖_intX
等多圖_intY
/

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI