TC官方合作论坛

标题: 蛤蟆练习第2帖 [打印本页]

作者: 250136457    时间: 2012-1-8 21:36
标题: 蛤蟆练习第2帖
namespace 坐天自动
//定义默认空间
int 线程1,线程运行1,线程2,线程运行2,线程3,线程运行3,百分比
string 百分
//以上是定义数据类型
function bool 按钮1_点击()
百分=edit.gettext("编辑框1")
        百分比=convert.strtoint("百分")
        help.messagebox("设置已保存")
        return ture
endfunction
//以上是点击 保存设置 按钮的脚本
function bool 线程运行3()
//以上是线程运行的脚本
        string 窗口集=window.enumwindow("大话西游 || ($Revision:")
        //枚举窗口,得到大话西游的窗口,只是针对于单开,双开会出错
        int 图像值,窗口
        窗口=convert.strtoint(窗口集)
        window.activate(窗口)
        window.setwindowpos(窗口,1,1)
        //将 窗口激活并调整到屏幕坐标1,1的位置
        int 图片X坐标,图片Y坐标,图像序号,X,Y
        int a=0
        while 0
            图像序号=color.findpic(0,0,1440,900,"E:\\实验\\自动.bmp",#102030,0.9,0,图片X坐标,图片Y坐标)
            if (图片X坐标>0 || 图片Y坐标>0)
                if(a==0)
                    a=1
                    mouse.mousemove(图片X坐标+30,图片Y坐标+15)
                    help.sleep(500)
                    mouse.leftclick(1)
                    help.sleep(500)
                    mouse.mousemove(图片X坐标-40,图片Y坐标-40)
                    X=图片X坐标
                    Y=图片Y坐标
                endif
            else
                if (X>10 ||Y>10)
                    if(a==1)
                        a=0
                        图像值=color.getpixelcolor((71+6)*百分比/100+(X-6),Y-487)
                        if (图像值>650016)
    mouse.mousemove((71+6)*百分比/100+(X-4),Y-487)
                                help.sleep(50)
                                mouse.rightclick(1)
                        endif
                    endif
                endif
            endif
            help.sleep(1000)
        endwhile
        return true         
endfunction
function bool 线程运行2()
while 0
            int du,小时2,分钟2,秒2
            string 小时1,分钟1,秒1,字符串1
            help.sleep(1000)
            du=system.gettickcount()
            小时2=du/1000/60/60
            分钟2=(du/1000/60)-(小时2*60)
            秒2=(du/1000)-(小时2*60*60)-(分钟2*60)
            小时1=convert.inttostr(小时2)
            分钟1=convert.inttostr(分钟2)
            秒1=convert.inttostr(秒2)
            字符串1=str.strcat("电脑已经运行了",小时1)
            字符串1=str.strcat(字符串1,"小时")
            字符串1=str.strcat(字符串1,分钟1)
            字符串1=str.strcat(字符串1,"分钟")
            字符串1=str.strcat(字符串1,秒1)
            字符串1=str.strcat(字符串1,"秒")
            statictext.settext("标签1",字符串1)
        endwhile
        return true
endfunction
function bool 线程运行1()
int time,time1,time2,小时1,分钟1,秒1
        string 小时,分钟,秒,字符串
        time1=system.gettickcount()
        while 0
            help.sleep(1000)
            time2=system.gettickcount()
            time=time2-time1
            小时1=time/1000/60/60
            分钟1=(time/1000/60)-(小时1*60)
            秒1=(time/1000)-(小时1*60*60)-(分钟1*60)
            小时=convert.inttostr(小时1)
            分钟=convert.inttostr(分钟1)
            秒=convert.inttostr(秒1)
            字符串=str.strcat("脚本已经运行了",小时)
            字符串=str.strcat(字符串1,"小时")
            字符串=str.strcat(字符串,分钟)
            字符串=str.strcat(字符串,"分钟")
            字符串=str.strcat(字符串,秒)
            字符串=str.strcat(字符串,"秒")
            statictext.settext("标签0",字符串)
        endwhile
        return true
endfunction
function bool start_click()
//这里添加你要执行的代码
线程1=thread.beginthread("坐天自动.线程运行1")
线程2=thread.beginthread("坐天自动.线程运行2")
线程3=thread.beginthread("坐天自动.线程运行3")
return true
//函数返回语句
endfunction
function bool exit_click()
//这里添加你要执行的代码
help.exit()
return true
//函数返回语句
endfunction
function bool 热键0_热键()
线程1=thread.beginthread(坐天自动.线程运行1)
        线程2=thread.beginthread(坐天自动.线程运行2)
        线程3=thread.beginthread(坐天自动.线程运行3)
       return true
endfunction
function bool 热键0_失去焦点()
hotkey.destroy("热键0")
        hotkey.register("热键0")
return true
endfunction
function bool 热键1_热键()
thread.closethread("线程1")
        thread.closethread("线程2")
        thread.closethread("线程3")
        return true
endfunction
function bool 热键1_失去焦点()
hotkey.destroy("热键1")
        hotkey.register("热键1")
        return true
endfunction
function bool 按钮0_点击()
thread.closethread(线程1)
        thread.closethread(线程2)
        thread.closethread(线程3)
        return true
endfunction
endnamespace
//空间结束语句

作者: 龍吟达人    时间: 2012-1-8 23:06
:*新手 支持顶一个
作者: 菜B    时间: 2012-1-8 23:39
学习学习,研究研究,此贴会火?
作者: guowei118    时间: 2013-11-8 21:18
这代码什么功能啊




欢迎光临 TC官方合作论坛 (http://bbs.52tc.co/) Powered by Discuz! X3.1