Q语言 我的命令库《通用找图》之前台找图函数源码

发布时间:2020-06-27 01:47:12 作者:鬼谷子2015
来源:网络 阅读:205

'---------------------前台找图F-------------------------------------


Function 找图F(pictname)  //前台找图
    FindPic 0,0,Plugin.Sys.GetScRX - 1,Plugin.Sys.GetScRY - 1, pic_path&pictname,0.9,找图_intX,找图_intY
    If 找图_intx >= 0 and 找图_inty >= 0 Then 
        日志运行内容 = V_当前程序 & "F---------->找到pict:" & pictname
        Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
        找图F=1
    Else 
        日志运行内容 = V_当前程序 & "F未找到pict:" & pictname
        Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
        找图F=0
    End If
End Function

Function 找图点击F(pictname,偏移X,偏移Y)  //前台找到图后点击
    找图点击F=0
    FindPic 0,0,Plugin.Sys.GetScRX - 1,Plugin.Sys.GetScRY - 1, pic_path&pictname,0.9,找图_intX,找图_intY
    If 找图_intX >= 0 Then 
        LockMouse
        SaveMousePos
        MoveTo 找图_intX + cint(偏移X), 找图_intY + cint(偏移Y)
        delay 50    
        LeftClick 1
        RestoreMousePos 
        UnlockMouse 
        日志运行内容 =  V_当前程序&"F---------->点击pict:"&pictname    
        Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
        找图点击F=1
    End If
End Function

Function 找多图F(pictname)
    Dim I,返回值,pict
    找多图F=0
    pict = split(pictname, "|")
    For i = 0 To ubound(pict)
        FindPic 0,0,Plugin.Sys.GetScRX - 1,Plugin.Sys.GetScRY - 1, pic_path&pict(i),0.9,找多图_intX,找多图_intY
        If 找多图_intx >= 0 Then 
            日志运行内容 =  "找到:第" & cstr(i + 1) & "张pict:" & pict(i)
            Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
            找多图F=i+1
            Exit For
        End If
        日志运行内容 =  "未找到第" & cstr(i + 1) & "张pict:"
        Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
    Next
End Function

Function 等图F(pictname)
    日志运行内容 =  "F正在等待pict....:" & pictname
    Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
    等图 = 0
    等图_intX = -1
    等图_intY = -1    
    For 10000
        返回值 = 找图F(pictname)
        If 返回值 > 0 Then 
            日志运行内容 =  V_当前程序&"B----------->等到pict:" & pictname
            Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
            等图_intX = 找图_intX
            等图_intY = 找图_intY            
            等图F=1
            Exit For
        End If
        Delay 500           
    Next
End Function

Function 等图点击F(pictname,偏移X,偏移Y)
    日志运行内容 =  "正在等待点击pict....:" & pictname
    Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
    等图点击=0
    For 100000
        FindPic 0,0,Plugin.Sys.GetScRX - 1,Plugin.Sys.GetScRY - 1,pic_path&pictname,0.9,等图_intX,等图_intY
        If 等图_intX >= 0 Then 
            LockMouse
            SaveMousePos
            MoveTo 等图_intX + cint(偏移X), 等图_intY + cint(偏移Y)
            Delay 50
            LeftClick 1
            RestoreMousePos 
            UnlockMouse 
            日志运行内容 =  V_当前程序&"F------------->点击pict:" & pictname 
            Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
            Delay 50
            等图点击=1
            Exit For
        End If
        Delay 500   
    Next
End Function

Function 等多图F(pictname)
    Dim 返回值
    等多图F=0
    等多图_intX = -1
    等多图_intY = -1
    For 10000
        返回值=找多图F(pictname)
        If 返回值 > 0 Then 
            等多图F = 返回值
            等多图_intX = 找多图_intX
            等多图_intY = 找多图_intY
            日志运行内容 =  "等到多pict:" & 返回值 
            Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
            Exit For
        End If
        日志运行内容 =  "遍历一次,未等到所有pict"
        Call Lib.通用.输出日志(日志运行内容):TracePrint 日志运行内容
        Delay 500  
    Next
End Function

//注:Lib.通用.输出日志(日志运行内容) 此函数在 命令库 《通用》中 以下同
/*

Sub 输出日志(日志内容)
    If V_输出运行日志 = 1 Then 
        Call Plugin.File.WriteFileEx(V_sPath & "脚本日志.txt", Now()& ": "&日志内容)//这边有加上执行该命令相应的系统时间
    End If
End Sub

*/

推荐阅读:
  1. Q语言 我的命令库《通用》窗口操作之绑定应用界面功能函数
  2. Q语言 我的命令库《通用找图》之后台找字函数源码

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

按键精灵 q语言

上一篇:python中eval不安全功能实验

下一篇:自然语言处理研发工程师

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》