查找当前鼠标所指点的颜色相同个数

查找当前鼠标所指点的颜色相同个数,结果会记录在桌面上 

运行环境:分辨率:1440×900 色深:32位 操作系统:Windows XP 按键精灵版本:7.00.3730

@兄弟工程师01    2009/3/19

Dim Rx(10000),Ry(10000)  
Plugin allx=Sys.GetScRX()  
Plugin ally=Sys.GetScRY()  
VBSCall GetCursorPos(sx,sy)  
VBSCall color=GetPixelColor(sx,sy)  
x=0:y=0:a=0:i=0  
Plugin t1=Sys.GetTime()  
While y<=ally/10  
    While x<=allx/10  
        //搜索范围,可自行调整  
        IfColor x y color 0  
            a=a+1  
            i=i+1  
            Rx(i)=x:Ry(i)=y  
        EndIf   
        MoveTo x y  
        x=x+1  
        //搜索密度,可自行调整  
    EndWhile   
    x=0  
    y=y+1  
    //搜索密度,可自行调整  
EndWhile   
Plugin t2=Sys.GetTime()  
t=t2-t1  
VBSCall MessageBox("当前分辨率"&allx&":"&ally&vbCr&"启动脚本时鼠标指向点坐标为"&sx&","&sy&vbCr&"所指点颜色为"&color&vbCr&"你当前屏幕共有 "&a&" 个相同颜色点"&vbCr&"总共耗时:"&t&" 毫秒"&vbCr&"详情看桌面的测试结果")  
Set objShell = CreateObject("WScript.Shell")  
desk = objShell.SpecialFolders.Item("desktop")  
//↑取得桌面路径  
set fso=CreateObject("Scripting.FileSystemObject")  
Const forreading=1  
const forwriting=2  
const forappending=8  
If fso.FileExists(desk&"\测试结果.txt")=0  
    set myfile=fso.createtextfile(desk&"\测试结果.txt")  
    how=0  
Else   
    set myfile=fso.opentextfile(desk&"\测试结果.txt",forreading)  
    While myfile.atendofstream=0  
        zero=myfile.readline  
        Lleft=instr(1,zero,"(")  
        Rright=instr(1,zero,")")  
        how=mid(zero,Lleft+1,Rright-Lleft-1)  
        //↑检测第几次检测  
    EndWhile   
    myfile.Close  
EndIf   
set myfile=fso.opentextfile(desk&"\测试结果.txt",forappending)  
//↑写一个TXT到桌面  
myfile.writeline("第("&how+1&")次测试于"&now)  
myfile.writeline("当前分辨率"&allx&":"&ally)  
myfile.writeline("启动脚本时鼠标指向点坐标为"&sx&","&sy)  
myfile.writeline("所指点颜色为"&color)  
myfile.writeline("你当前屏幕共有 "&a&" 个相同颜色点")  
myfile.writeline("总共耗时:"&t&" 毫秒")  
//↑上面就是写进TXT的测试结果  
If a<>0  
    myfile.writeline("下面是找到点的坐标:x,y")  
    While i>0  
        myfile.writeline(Rx(i)&","&Ry(i))  
        i=i-1  
    EndWhile   
    //↑上面就是写进TXT的找到的点坐标  
EndIf   
myfile.Close
相关文件下载地址
©下载资源版权归作者所有;本站所有资源均来源于网络,仅供学习使用,请支持正版!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注