TC官方合作论坛

 找回密码
 立即注册
查看: 864|回复: 3
打印 上一主题 下一主题

[问题] 在脚本区下的怎么出问题了呢。高手进来看看

[复制链接]
跳转到指定楼层
楼主
发表于 2012-7-6 22:37:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上加入TC

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
他界面要求键入账号和密码, 点开始或F2,就运行脚本了,鼠标右击游戏他自动输入账号密码。
但是完了就停在人物那里了,不动了。。。
下的那个是全脚本的,带文件夹的,带界面的。不多说上码:
#import "dm.dmsoft" Dm
#import "DBSoft.DBSoft_MouseKey" Mk

namespace 征途刺探
//定义默认空间
int[][] ArrayA

function bool clear(int hwnd)
//游戏后开始后,清理各类提示信息.
int qdx,qdy,qxx,qxy

int ccx,ccy
while (true)
    //清屏完成后,按一次 Esc,会出来有一个带 财产 字符串的界面.以此为标示.
    Dm.FindStr(0,0,2000,2000,"财产","fffffff-000000",1.0,ccx,ccy)
    if (ccx>0)
        drivekeyboard.keypress(27,1)
        help.sleep(200)
        break
    else //有两类弹出窗,一类是 确定.一类是确定加取消.双选要求点取消.或Esc键.确定的只能点击.
        Dm.FindStr(0,0,2000,2000,"取消","fffffff-000000",1.0,qxx,qxy)
        if (qxx>0)
            drivekeyboard.keypress(27,1)
            help.sleep(200)
        else
            Dm.FindStr(0,0,2000,2000,"确定","fffffff-000000",1.0,qdx,qdy)
            if (qdx>0)
                Dm.ClientToScreen(hwnd,qdx,qdy)
                drivemouse.mousemove(qdx+5,qdy+5)
                help.sleep(100)
                drivemouse.leftclick(1)
                help.sleep(200)
            endif
        endif
        drivekeyboard.keypress(27,1)
        help.sleep(500)
    endif
endwhile

return true
endfunction


//骑马
function bool horse(int hwnd)
int mx,my,xx,xy
while(true)
Dm.FindStr(0,0,2000,2000,"匹","fffffff-000000",1.0,mx,my)
if (mx>0)
    Dm.ClientToScreen(hwnd,mx,my)
    drivemouse.mousemove(mx+5,my+5)
    help.sleep(100)
    drivemouse.leftclick(1)
    help.sleep(200)
    while(true)
        Dm.FindStr(0,0,2000,2000,"下","b0c9c6-4f3639",1.0,xx,xy)
        if (xx<0)
            drivekeyboard.keypress(84,1) //按 T 键,上马.
            help.sleep(500)
        else
            break
        endif
    endwhile
    break
else
    drivekeyboard.keypress(78,1) //按 N 键 打开 马 界面
    help.sleep(200)
endif
endwhile

drivekeyboard.keypress(78,1)

return true
endfunction

//领车
function bool car(int hwnd)
int carx,cary,zcx,zcy,jzx,jzy,zcmx,zcmy
while(true)
Dm.FindPic (0,0,2000,2000,"car.bmp","000000",0.9,0,carx,cary)
if (carx<0)
    //按 O 打开社会,选择 家族,点击领取战车,选择第一个车.领用.
    Dm.FindStr(0,0,2000,2000,"领取战车","ffffff-000000",1.0,zcx,zcy)
    if (zcx>0)
        Dm.ClientToScreen(hwnd,zcx,zcy)
        drivemouse.mousemove(zcx,zcy)
        help.sleep(200)
        drivemouse.leftclick(1)
        help.sleep(200)
     
        while(true)
        Dm.FindStr(0,0,2000,2000,"领用","ffffff-000000",1.0,zcmx,zcmy)
        if (zcmx>0)
            Dm.ClientToScreen(hwnd,zcmx,zcmy)
            drivemouse.mousemove(zcmx,zcmy-95)
            help.sleep(200)
            drivemouse.leftclick(1)
            help.sleep(500)
            drivemouse.mousemove(zcmx+5,zcmy+5)
            help.sleep(200)
            drivemouse.leftclick(1)
            help.sleep(500)
            drivekeyboard.keypress(27,1)
            break
        endif
        help.sleep(500)
        endwhile
      
    else
        if (zcmx>0)
            return false
        else
        Dm.FindStr(0,0,2000,2000,"家族","ffffff-000000",1.0,jzx,jzy)
        if(jzx>0)
            Dm.ClientToScreen(hwnd,jzx,jzy)
            drivemouse.mousemove(jzx,jzy)
            help.sleep(200)
            drivemouse.leftclick(1)
        else
            drivekeyboard.keypress(79,1) //按 O 键打开社会
        endif
        endif
    endif
else
     break
endif
endwhile

return true
endfunction

function bool login(int hwnd)
int zhx,zhy,lgx,lgy,qdx,qdy
if (str.strleng(edit.gettext("id"))>0&&str.strleng(edit.gettext("pwd"))>0)
Dm.FindStr(0,0,2000,2000,"账号","dde6e4-22191b",1.0,zhx,zhy)
if (zhx>0)
    Dm.ClientToScreen(hwnd,zhx,zhy)
    drivemouse.mousemove(zhx+165,zhy+5)
    help.sleep(100)
    drivemouse.leftclick(1)
    help.sleep(100)
    drivekeyboard.keypress(8,16)   
    drivekeyboard.keystring(edit.gettext("id"))
    drivekeyboard.keypress(9,1)
    drivekeyboard.keypress(8,16)
    drivekeyboard.keystring(edit.gettext("pwd"))
    help.sleep(100)
    drivekeyboard.keypress(13,1)
    help.sleep(1000)
    while(true)
    Dm.FindStr(492,717,565,744,"进入游戏","ffffff-000000",1.0,lgx,lgy)
    if (lgx>0)
        Dm.ClientToScreen(hwnd,lgx,lgy)
        drivemouse.mousemove(lgx+5,lgy+5)
        help.sleep(100)
        drivemouse.leftclick(1)
        break
    else
        Dm.FindStr(0,0,2000,2000,"确定","ffffff-000000",1.0,qdx,qdy)
        if (qdx>0)
            Dm.ClientToScreen(hwnd,qdx,qdy)
            drivemouse.mousemove(qdx+5,qdy+5)
            help.sleep(100)
            drivemouse.leftclick(1)
            help.sleep(200)
            return false
        else
            help.sleep(1000)
        endif
    endif
    endwhile
endif
else
    help.messagebox("从登陆界面启动,要求填写账号密码")
    return false
endif

return true
endfunction

function bool yntask(int hwnd)
int zx,zy,zox,zoy,csx,csy
Dm.FindStr(0,0,2000,2000,"找","a7dbd9-000000",1.0,zx,zy)
if (zx>0) //打开每日任务玩法
    Dm.ClientToScreen(hwnd,zx,zy)
    drivemouse.mousemove(zx-10,zy+20)
    help.sleep(100)
    drivemouse.leftclick(1)

        help.sleep(2000)
        drivekeyboard.keypress(27,1)
      help.sleep(500)
endif

Dm.FindPic (0,0,2000,2000,"总1.bmp|总2.bmp","000000",0.9,0,zox,zoy)
if (zox>0)
    Dm.ClientToScreen(hwnd,zox,zoy)
    drivemouse.mousemove(zox+5,zoy+5)
    help.sleep(100)
    drivemouse.leftclick(1)
    help.sleep(1000)
    drivemouse.mousemove(zox-90,zoy+80)
    help.sleep(100)
    drivemouse.leftclick(1)
endif

help.sleep(1000)
Dm.FindStr(0,0,2000,2000,"0/3|1/3|2/3","fffa29-000000",1.0,csx,csy)
if (csx<0)
    return false
endif

drivekeyboard.keypress(27,2)

return true
endfunction

function bool die(int hwnd)
int diex,diey
Dm.FindStr(0,0,2000,2000,"安全复活","ffffff-000000",1.0,diex,diey)
if (diex>0)
    Dm.ClientToScreen(hwnd,diex,diey)
    drivemouse.mousemove(diex+5,diey+5)
    help.sleep(50)
    drivemouse.leftclick(2)
    return false
endif

return true
endfunction


function bool gobj(int hwnd)
int cfx,cfy,bjx,bjy,wcx,wcy
//从皇城到边境 点 F 打开附近玩家 ,找到 车夫 双击 寻路到车夫,自动打开菜单,点击 边境 进行传送.
//起点要求为 王城

Dm.FindStr(0,0,2000,2000,"王城","ffffff-000000",1.0,wcx,wcy)
if (wcx>0)

while(true)
Dm.FindStr(0,0,2000,2000,"边境","6df376-000000",1.0,bjx,bjy)
if (bjx>0)
    Dm.ClientToScreen(hwnd,bjx,bjy)
    drivemouse.mousemove(bjx+5,bjy+5)
    help.sleep(100)
    drivemouse.leftclick(2)
    break
else
        Dm.FindStr(0,0,2000,2000,"车夫","ffff00-000000",1.0,cfx,cfy)
        if (cfx>0)
                Dm.ClientToScreen(hwnd,cfx,cfy)
                drivemouse.mousemove(cfx+15,cfy+5)
                help.sleep(100)
                drivemouse.leftclick(2)
                help.sleep(500)
        else
                drivekeyboard.keypress(70,1)
                help.sleep(200)
        endif
endif
endwhile
else
    return false
endif
return true
endfunction

function bool gettask(int hwnd)
int bjx,bjy,jjx,jjy,wpx,wpy,jsx,jsy
string gj

while(true)
Dm.FindStr(0,0,2000,2000,"边境","ffffff-000000",1.0,bjx,bjy)
if (bjx>0)
        Dm.FindStr(0,0,2000,2000,"古玩","6df376-000000",1.0,wpx,wpy)
        if (wpx>0)
                Dm.ClientToScreen(hwnd,wpx,wpy)
                drivemouse.mousemove(wpx+5,wpy+5)
                help.sleep(100)
                drivemouse.leftclick(2)
                help.sleep(500)
                gj=Dm.Ocr(35,467,139,503,"59f9ce-000000",1.0)
                gj=str.strtrim(gj,"探")
              //  help.messagebox(gj)
                help.sleep(200)
                jsx=100
                jsy=485
                Dm.ClientToScreen(hwnd,jsx,jsy)
                drivemouse.mousemove(jsx,jsy)
                help.sleep(100)
                drivemouse.leftclick(2)
                break
        else
             Dm.FindStr(0,0,2000,2000,"守边大将军","59e8f9-000000",1.0,jjx,jjy)
                if (jjx>0)
                        Dm.ClientToScreen(hwnd,jjx,jjy)
                        drivemouse.mousemove(jjx+5,jjy+5)
                        help.sleep(100)
                        drivemouse.leftclick(2)
                        help.sleep(200)
                endif
        endif
else
    help.sleep(500)
endif
endwhile

int csx,csy,xcx,xcy,zcx,zcy
xcx=515
xcy=390
   
Dm.FindPic (0,0,2000,2000,"car.bmp","000000",0.9,0,zcx,zcy)
if (zcx>0)
        //点击 右侧 战车,以便打开战车菜单
        Dm.ClientToScreen(hwnd,zcx,zcy)
        drivemouse.mousemove(zcx+5,zcy+5)
        help.sleep(100)
        drivemouse.leftclick(1)
        help.sleep(500)
        
        //点击 召唤战车,弹出菜单位置固定不变
        Dm.ClientToScreen(hwnd,xcx,xcy)
        drivemouse.mousemove(xcx,xcy)
        help.sleep(100)
        drivemouse.leftclick(1)
        help.sleep(8000)
endif

int qdx,qdy,zccsx,zccsy,gjx,gjy,cszx,cszy,cgx,cgy
//偶尔上车后,会提示进入不保护状态.点击确定
Dm.FindStr(0,0,2000,2000,"确定","fffffff-000000",1.0,qdx,qdy)
if (qdx>0)
        Dm.ClientToScreen(hwnd,qdx,qdy)
        drivemouse.mousemove(qdx+5,qdy+5)
        help.sleep(100)
        drivemouse.leftclick(1)
        help.sleep(200)
   endif     
if(str.strleng(gj)>0)
    while(true)
        Dm.FindStr(0,0,2000,2000,"战车传送","59f9ce-000000",1.0,zccsx,zccsy)
        if (zccsx>0)
                Dm.ClientToScreen(hwnd,zccsx,zccsy)
                drivemouse.mousemove(zccsx+5,zccsy+5)
                help.sleep(100)
                drivemouse.leftclick(2)
                help.sleep(2000)
                       
                Dm.FindStr(0,0,2000,2000,gj,"6df376-000000",1.0,gjx,gjy)
                if(gjx>0)
                        Dm.ClientToScreen(hwnd,gjx,gjy)
                        drivemouse.mousemove(gjx+5,gjy+5)
                        help.sleep(100)
                        drivemouse.leftclick(2)
                        help.sleep(2000)
                        Dm.FindStr(0,0,2000,2000,gj+"边境","6df376-000000",1.0,cgx,cgy)
                        if (cgx>0)
                            drivekeyboard.keypress(27,1)
                        endif
                        break
                 endif
        else
                Dm.FindStr(0,0,2000,2000,"边境传送柱","59e8f9-000000|ffff00-000000",1.0,cszx,cszy)
                if (cszx>0)
                        Dm.ClientToScreen(hwnd,cszx,cszy)
                        drivemouse.mousemove(cszx+15,cszy+10)
                        help.sleep(100)
                        drivemouse.leftclick(2)
                        help.sleep(500)
                endif
        endif
    endwhile
endif

return true
endfunction

//从边境走到龙牙关
function bool bjtonyg(int hwnd)

int nx,ny,wx,wy,dtx,dty

while(true)   
Dm.FindStr(0,0,2000,2000,"龙","fcf4b8-000000",1.0,nx,ny)
if  (nx>0)
Dm.ClientToScreen(hwnd,nx,ny)
drivemouse.mousemove(nx+47,ny-1)  //边境到龙牙关
help.sleep(100)
drivemouse.leftclick(1)
help.sleep(500)
drivekeyboard.keypress(77,1)
break
else
drivekeyboard.keypress(77,1)
help.sleep(2000)
endif   
endwhile

while(true)
    Dm.FindStr(0,0,2000,2000,"龙牙关","ffffff-000000",1.0,dtx,dty)
    if (dtx>0)
        Dm.FindStr(0,0,2000,2000,"王","fcf4b8-000000",1.0,wx,wy)
        if (wx>0)
                Dm.ClientToScreen(hwnd,wx,wy)
                drivemouse.mousemove(wx-17,wy-4) //龙牙关到王城
                help.sleep(100)
                drivemouse.leftclick(1)
                help.sleep(1000)
                drivekeyboard.keypress(77,1)
                break
        else
                drivekeyboard.keypress(77,1)
                help.sleep(2000)
        endif
     else
//检测是否死亡
        if(征途刺探.die(hwnd)==false)
                return false
        endif
    endif
endwhile

while(true)
    Dm.FindStr(0,0,2000,2000,"王城","ffffff-000000",1.0,dtx,dty)
    if (dtx>0)
        Dm.FindStr(0,0,2000,2000,"探","fcf7fd-000000",1.0,wx,wy)
        if (wx>0)
                Dm.ClientToScreen(hwnd,wx,wy)
                drivemouse.mousemove(wx+7,wy+14) //到流浪者附近
                help.sleep(100)
                drivemouse.leftclick(1)
                help.sleep(1000)
                drivekeyboard.keypress(77,1)
                break
        else
                drivekeyboard.keypress(77,1)
                help.sleep(2000)
        endif
     else
//检测是否死亡
        if(征途刺探.die(hwnd)==false)
                return false
        endif
    endif
endwhile

//交任务
int wpx,wpy,xcx,xcy,tx,ty,kqx,kqy
while(true)
    Dm.FindPic (0,0,2000,2000,"瓦.bmp","000000",0.9,0,wpx,wpy)
    if (wpx>0)
        Dm.ClientToScreen(hwnd,wpx,wpy)
        drivemouse.mousemove(wpx-155,wpy+115)
        help.sleep(100)
        int  number= mouse.getmouseshape()
        if (number==37879230)
            Dm.FindPic (0,0,2000,2000,"下车.bmp","000000",0.9,0,xcx,xcy)
            if (xcx>0)
                Dm.ClientToScreen(hwnd,xcx,xcy)
                drivemouse.mousemove(xcx+5,xcy+5)
                help.sleep(100)
                drivemouse.leftclick(1)
                help.sleep(100)
                drivekeyboard.keypress(112,2)
                help.sleep(100)
            endif
            drivemouse.mousemove(wpx-155,wpy+115)
            help.sleep(100)
            drivemouse.leftclick(1)
            help.sleep(200)
            Dm.FindStr(0,0,2000,2000,"探","6df376-000000",1.0,tx,ty)
            if (tx>0)
                Dm.ClientToScreen(hwnd,tx,ty)
                drivemouse.mousemove(tx+5,ty+5)
                help.sleep(100)
                drivemouse.leftclick(1)
                help.sleep(200)
               
                Dm.FindStr(0,0,2000,2000,"不客气","6df376-000000",1.0,kqx,kqy)
                if (kqx>0)
                Dm.ClientToScreen(hwnd,kqx,kqy)
                drivemouse.mousemove(kqx+5,kqy+5)
                help.sleep(100)
                drivemouse.leftclick(1)
                help.sleep(200)
                endif
            endif
            break
        endif
    else
        help.sleep(1000)
    endif
endwhile


征途刺探.horse(hwnd)

help.sleep(200)
while(true)
Dm.FindStr(0,0,2000,2000,"龙","fcf4b8-000000",1.0,nx,ny)
if  (nx>0)
Dm.ClientToScreen(hwnd,nx,ny)
drivemouse.mousemove(nx+55,ny+29) //从王城回 龙牙关
help.sleep(200)
drivemouse.leftclick(1)   
help.sleep(500)
drivekeyboard.keypress(77,1)
break
else
    drivekeyboard.keypress(77,1)
    help.sleep(500)
endif
endwhile

while(true)
    Dm.FindStr(0,0,2000,2000,"龙牙关","ffffff-000000",1.0,dtx,dty)
    if (dtx>0)
        drivekeyboard.keypress(123,2)
        help.sleep(2000)
        break
    else
        if(征途刺探.die(hwnd)==false)
            help.sleep(2000)
                return true
        endif
    endif
endwhile
   
return true
endfunction



function bool totask(int hwnd)

int bjx,bjy,jjx,jjy,wpx,wpy,jsx,jsy,gjx,gjy


while(true)
Dm.FindStr(0,0,2000,2000,"边境","ffffff-000000",1.0,bjx,bjy)
if (bjx>0)
        Dm.FindStr(0,0,2000,2000,"过奖","6df376-000000",1.0,jsx,jsy)
        if (jsx>0)
                Dm.ClientToScreen(hwnd,jsx,jsy)
                drivemouse.mousemove(jsx+5,jsy+5)
                help.sleep(100)
                drivemouse.leftclick(2)
                help.sleep(100)
                drivekeyboard.keypress(27,1)               
                break
         else       
                Dm.FindStr(0,0,2000,2000,"探","ddf77c-000000",1.0,wpx,wpy)
                if (wpx>0)
                        Dm.ClientToScreen(hwnd,wpx,wpy)
                        drivemouse.mousemove(wpx+5,wpy+5)
                        help.sleep(100)
                        drivemouse.leftclick(2)
                        help.sleep(1000)
                else
                        Dm.FindStr(0,0,2000,2000,"守边大将军","59e8f9-000000",1.0,jjx,jjy)
                        if (jjx>0)
                                Dm.ClientToScreen(hwnd,jjx,jjy)
                                drivemouse.mousemove(jjx+5,jjy+5)
                                help.sleep(100)
                                drivemouse.leftclick(2)
                                help.sleep(500)
                        endif
                endif
        endif
else
    help.sleep(500)
endif
endwhile


return true
endfunction




function bool strat()
int cx,cy,hwnd

string Apath=help.getrcpath("rc:")
Dm.SetPath(Apath)
Dm.SetPicPwd("picpwd")
Dm.SetDictPwd("dictpwd")
Dm.SetDict(0,"刺探.txt")

int x=(list.getcount("list0")-1)
while(x>=0)
    if (ArrayA[1][x]>0)
        string caption=list.gettext("list0",x)
        hwnd=convert.strtoint(str.strcut(caption,str.findstr(caption,"*")+2,true),0)
        break
    else
        x=x-1
    endif
endwhile

Dm.BindWindow(hwnd,"normal","normal","normal",0)
help.sleep(2000)

//判断当前为游戏内还是登陆界面
Dm.FindStr(0,0,2000,2000,"充","fff000-000000",1.0,cx,cy)
if (cx<0)
//登陆

if (征途刺探.login(hwnd)==false)
    //本来想用 if(!征途刺探.login(hwnd)) 来表示的,即: 非假即真,却发现,这样会重复调用两次!!!
    help.messagebox("账号或密码未填 或不正确,或者此账号正在使用,程序停止")
    ArrayA[1][x]=0
    return false
endif
endif

//判断是否到达游戏内
while (Dm.FindStr(0,0,2000,2000,"充","fff000-000000",1.0,cx,cy)==-1)   
    help.sleep(1000)
endwhile

//清屏
征途刺探.clear(hwnd)

help.sleep(500)

//检测任务是否完成
if (征途刺探.yntask(hwnd)==false)
    help.messagebox("此账号任务已经完成")
        ArrayA[1][x]=0
    return false
endif
help.sleep(500)

//领车
if (征途刺探.car(hwnd)==false)
    help.messagebox("领车不成功,当前程序停止 ")
    ArrayA[1][x]=0
    return false
endif
help.sleep(500)

//上马
征途刺探.horse(hwnd)
help.sleep(500)

//去边境
if (征途刺探.gobj(hwnd)==false)
    help.messagebox("当前角色不在王城")
    ArrayA[1][x]=0
    return false
endif
help.sleep(2000)

//接任务
征途刺探.gettask(hwnd)
help.sleep(2000)

//清屏
征途刺探.clear(hwnd)
help.sleep(2000)

//边境到龙牙关
if(征途刺探.bjtonyg(hwnd)==false)
    help.messagebox("角色死亡,回城")
    ArrayA[1][x]=0
    return false
endif
help.sleep(2000)

//上马
征途刺探.horse(hwnd)
help.sleep(500)
//去边境
征途刺探.gobj(hwnd)
help.sleep(500)
//交任务
征途刺探.totask(hwnd)


help.messagebox("标志,程序写到此,正常结束")
ArrayA[1][x]=0


return true
endfunction


function bool unbind()
Dm.UnBindWindow()
//help.messagebox("停止成功OK")
return true
endfunction



function bool start_click()
//这里添加你要执行的代码
Mk.WaitMouseKey(2,200)
//等待 鼠标右键单击 后,才运行下面代码.

//在鼠标右键击后,获取当前鼠标所在窗口句柄,并根据句柄得到标题,以来判断其窗口是否为 征途2

int name=window.getmousemovewndhand()
string caption=window.getwindowcaption(name)
if (str.findstr(caption,"征途2")==-1)
    help.messagebox("当前窗口非 征途2 ,请重新选择")
    return true
else
    //初始化 刷新后将句柄存入ArrayA[0][x]中
//如果发现此次获取的句柄在数组没有.判断为新增加窗口
int x=0   
    while(true)
     if (name==ArrayA[0][x])
           break
     else
         if(ArrayA[0][x]==0)
             //help.messagebox("新窗口")
             征途刺探.refur_click()
             x=0
         else
         x=x+1
         endif
     endif
    endwhile
   
    int y=list.getcount("list0")-1
    while(y>=0)
        if (ArrayA[1][y]>0)
                help.messagebox("单开程序,已有一线程运作,不能再开启新的线程.")
                return false
        else
                y=y-1
        endif
    endwhile

int tb= thread.beginthreadex("征途刺探.strat","征途刺探.unbind")
ArrayA[1][x]=tb

endif


return true
//函数返回语句
endfunction

function bool exit_click()
//这里添加你要执行的代码
征途刺探.hkstop_onhotkey()
help.exit()

return true
//函数返回语句
endfunction



function bool refur_click()
//这里添加你要执行的代码
int wz,x,y,t,z
string hwnds,hwnd
z=list.getcount("list0")
hwnds=system.enum("征途2",0)
if(str.strleng(hwnds)>0)
while(true)
                wz=str.findstr(hwnds,"|")
                hwnd=str.strsub(hwnds,0,wz) //查找枚举结果中的标志 | 的位置 ,并以此为参照,截取出每一个句柄
                y=z-1
                t=0  
                //以下循环,判断再次找到句柄是否为列表中已有句柄
                while(y>=0)
                string caption=list.gettext("list0",y)
                    string lhwnd=str.strcut(caption,str.findstr(caption,"*")+2,true)
                    if (hwnd==lhwnd)
                        t=1
                    endif
                    y=y-1
                endwhile
                        
                if (t==0) // 仅操作列表中没有的句柄
                ArrayA[0][x]=convert.strtoint(hwnd,0) //将句柄存入数组中.
               
                //以 句柄 标题(去除空格了),与标志符 * 和句柄,组成列表框中内容.
                list.addstring("list0",str.strtrim(window.getwindowcaption(convert.strtoint(hwnd,0))," ")+" * " + hwnd)
                x=x+1
                if (wz==-1)
                        break
                else
                        hwnds=str.strcut(hwnds,wz+1,true)
                endif
                else
                    break
                endif
        endwhile
else
    control.enable("active",false)
    list.deleteall("list1")
endif
   
return true
endfunction


function bool init()
//这里添加你要执行的代码
ArrayA=int[10][100]
control.show("hkstart",false)
control.show("hkstop",false)
control.show("hksuspend",false)
control.show("re",false)
control.show("picture1",false)
help.settray("征途刺探",true)

征途刺探.refur_click()

return true
endfunction


function bool list0_selectchange()
//在列表 0中,发现改变时,检测当前所选项句柄句,窗口是否有效.线程是否开启
// 对带无效窗口的项,使 激活 按键不可见.
string tb,ck

string caption=list.getchecktext("list0")
if (str.strleng(caption)>0)
string hwnd=str.strcut(caption,str.findstr(caption,"*")+2,true)

if(window.iswindow(convert.strtoint(hwnd,0)))
    ck="当前窗口运行正常"
    control.enable("active",true)
else
    ck="当前窗口已经关闭"
    control.enable("active",false)
endif   

int ID=list.getcursel("list0")
if (ArrayA[1][ID]>0)
     tb="线程正在运行"
else
     tb="没有线程开启"
endif

list.deleteall("list1")
list.addstring("list1","当前选项句柄为  "+hwnd)
list.addstring("list1",ck)
list.addstring("list1",tb)
else
    control.enable("active",false)
    list.deleteall("list1")
endif

return true
endfunction


function bool active_click()
//这里添加你要执行的代码
string caption=list.getchecktext("list0")
//得到TC生成文件的句柄,即本身句柄
//int me=window.findwndclass("#32770")
//用大漠工具得到生成文件的类名为 #32770.
//再用类名到句柄.开始几次正常.后来间或不正常,很奇怪的问题.
//用AB抓抓无法得到类名
int me=window.findwindow("征途刺探")
//help.messagebox(window.getwindowcaption(me))
//help.messagebox(convert.inttostr(me))
if (str.strleng(caption)>0)
int hwnd=convert.strtoint(str.strcut(caption,str.findstr(caption,"*")+2,true),0)
//这一段是 窗口置顶,
//本来想用 window.setwindowtop ,却发现是永久置顶,而解除置顶后,又不在激活状态.
//所以采用了激活
if(window.iswindow(hwnd))
window.activate(hwnd)
help.sleep(1000)
window.activate(me)
endif
endif
return true
endfunction




function bool top_click()
//选中置顶,由于取消置顶的当次操作,会将窗口置后.特在取消置顶后,加入 激活.
int me=window.findwindow("征途刺探")
if (check.getstate("top"))
    window.setwindowtop(me,true)
else
    window.setwindowtop(me,false)
    window.activate(me)
endif

return true
endfunction

function bool small_click()
//这里添加你要执行的代码
//勾中则最小化至托盘
if (check.getstate("small"))
    help.settray("征途刺探",false)
else
    help.settray("征途刺探",true)
endif
return true
endfunction


function bool hkstop_onhotkey()
//快捷键 F5 结束线程
int x=(list.getcount("list0")-1)
while(x>=0)
    if (ArrayA[1][x]>0)
        thread.closethread(ArrayA[1][x])
        ArrayA[1][x]=0
        break
    else
        x=x-1
    endif
endwhile

return true
endfunction

function bool hkstart_onhotkey()
//快捷键 F2 开始任务.
征途刺探.start_click()
return true
endfunction


function bool hksuspend_onhotkey()
//快捷键 F3 暂停
int x=(list.getcount("list0")-1)
while(x>=0)
    if (ArrayA[1][x]>0)
        thread.suspendthread(ArrayA[1][x])
        ArrayA[1][x]=0
        break
    else
        x=x-1
    endif
endwhile
return true
endfunction





function bool re_click()
//这里添加你要执行的代码
control.show("list0",true)
control.show("list1",true)
control.show("Static0",true)
control.show("Static1",true)
control.show("Static2",true)
control.show("refur",true)
control.show("active",true)
control.show("sm",true)
control.show("re",false)
control.show("start",true)
control.show("exit",true)
control.show("top",true)
control.show("small",true)
control.show("id",true)
control.show("pwd",true)
control.show("picture0",true)
control.show("picture1",false)
return true
endfunction


function bool sm_click()
//这里添加你要执行的代码

control.show("list0",false)
control.show("list1",false)
control.show("Static0",false)
control.show("Static1",false)
control.show("Static2",false)
control.show("refur",false)
control.show("active",false)
control.show("sm",false)
control.show("re",true)
control.show("start",false)
control.show("exit",false)
control.show("top",false)
control.show("small",false)
control.show("id",false)
control.show("pwd",false)
control.show("picture0",false)
control.show("picture1",true)
return true
endfunction

endnamespace
//空间结束语句
回复

使用道具 举报

沙发
发表于 2012-7-7 07:57:31 | 只看该作者
这种问题,有时候是游戏的更新,有时候是软件的更新,你能看得懂代码,你可以自己找,这代码太长了,又不知道问题所在,所以,建议你先研究下,找出错误
回复 支持 反对

使用道具 举报

板凳
 楼主| 发表于 2012-7-7 08:19:54 | 只看该作者
我直接把做CT的那部分放到开始那里,自动登陆给他删了。可以正常使用了
回复 支持 反对

使用道具 举报

地板
发表于 2012-7-7 09:28:33 | 只看该作者
路过,学习
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /2 下一条

关闭

小黑屋|TC官方合作论坛 (苏ICP备18043773号

GMT+8, 2025-10-14 06:56 , Processed in 0.186551 second(s), 24 queries .

Powered by 海安天坑软件科技有限公司

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表