找回密码
 加入
搜索
查看: 5175|回复: 5

[AU3基础] 怎么加入点击以后停止倒计时?

[复制链接]
发表于 2015-1-17 16:39:26 | 显示全部楼层 |阅读模式
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <FontConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>

#Region ### START Koda GUI section ### Form=e:\窗口\装机软件选择.kxf
Global $time = 10
$Form2 = GUICreate("装机软件选择", 513, 291, 865, 416)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 497, 201)
$Icon1 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\yjghost.ico", -1, 32, 8, 33, 33)
$Icon4 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\2345好压.ico", -1, 113, 9, 32, 32)
$Icon5 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\2345看图王.ico", -1, 111, 73, 33, 33)
$Icon6 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\2345手机助手.ico", -1, 112, 138, 33, 33)
$Icon7 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\360杀毒.ico", -1, 192, 10, 33, 33)
$Icon8 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\360安全卫士.ico", -1, 193, 74, 33, 33)
$Icon9 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\360浏览器.ico", -1, 193, 138, 33, 33)
$Icon10 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\百度浏览器.ico", -1, 273, 10, 33, 33)
$Icon11 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\百度输入法.ico", -1, 272, 73, 33, 33)
$Icon12 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\mbox.ico", -1, 272, 137, 33, 33)
$Icon13 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\暴风影音.ico", -1, 353, 10, 33, 33)
$Icon14 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\酷狗.ico", -1, 353, 73, 33, 33)
$Icon15 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\pptv.ico", -1, 353, 137, 33, 33)
$Icon3 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\迅雷.ico", -1, 33, 137, 33, 33)
$Icon2 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\qq.ico", -1, 32, 73, 32, 32)
$Labe1 = GUICtrlCreateLabel("一键Ghost", 32, 48, 56, 17)
$Labe2 = GUICtrlCreateLabel("解压缩", 112, 48, 40, 17)
$Labe3 = GUICtrlCreateLabel("360杀毒", 192, 48, 46, 17)
$Labe4 = GUICtrlCreateLabel("百度浏览器", 272, 48, 64, 17)
$Labe5 = GUICtrlCreateLabel("暴风影音", 352, 48, 52, 17)
$Labe6 = GUICtrlCreateLabel("QQ", 32, 112, 20, 17)
$Labe7 = GUICtrlCreateLabel("看图工具", 112, 112, 52, 17)
$Labe8 = GUICtrlCreateLabel("360卫士", 192, 112, 46, 17)
$Labe9 = GUICtrlCreateLabel("百度输入法", 272, 112, 64, 17)
$Labe10 = GUICtrlCreateLabel("酷狗音乐", 352, 112, 52, 17)
$Labe11 = GUICtrlCreateLabel("迅雷", 32, 176, 28, 17)
$Labe12 = GUICtrlCreateLabel("手机助手", 112, 176, 52, 17)
$Labe13 = GUICtrlCreateLabel("360浏览器", 192, 176, 58, 17)
$Labe14 = GUICtrlCreateLabel("酷我音乐", 272, 176, 52, 17)
$Labe15 = GUICtrlCreateLabel("PPTV", 352, 176, 32, 17)
$Icon16 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\WPS.ico", -1, 433, 9, 33, 33)
$Icon17 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\PPT美化.ico", -1, 433, 74, 33, 33)
$Icon18 = GUICtrlCreateIcon("C:\Documents and Settings\Administrator\桌面\ico\爱奇艺.ico", -1, 433, 138, 33, 33)
$Labe16 = GUICtrlCreateLabel("WPS", 432, 48, 29, 17)
$Labe17 = GUICtrlCreateLabel("PPT美化", 432, 112, 49, 17)
$Labe18 = GUICtrlCreateLabel("爱奇艺", 432, 176, 40, 17)
$Checkbox1 = GUICtrlCreateCheckbox("", 72, 16, 33, 25)
$Checkbox2 = GUICtrlCreateCheckbox("", 73, 82, 33, 25)
$Checkbox3 = GUICtrlCreateCheckbox("", 73, 145, 33, 25)
$Checkbox4 = GUICtrlCreateCheckbox("", 153, 145, 33, 25)
$Checkbox5 = GUICtrlCreateCheckbox("", 153, 81, 33, 25)
$Checkbox6 = GUICtrlCreateCheckbox("", 152, 18, 33, 25)
$Checkbox7 = GUICtrlCreateCheckbox("", 233, 17, 33, 25)
$Checkbox8 = GUICtrlCreateCheckbox("", 233, 82, 33, 25)
$Checkbox9 = GUICtrlCreateCheckbox("", 233, 146, 33, 25)
$Checkbox10 = GUICtrlCreateCheckbox("", 313, 146, 33, 25)
$Checkbox11 = GUICtrlCreateCheckbox("", 313, 82, 33, 25)
$Checkbox12 = GUICtrlCreateCheckbox("", 313, 18, 33, 25)
$Checkbox13 = GUICtrlCreateCheckbox("", 392, 17, 33, 25)
$Checkbox14 = GUICtrlCreateCheckbox("", 392, 82, 33, 25)
$Checkbox15 = GUICtrlCreateCheckbox("", 392, 145, 33, 25)
$Checkbox16 = GUICtrlCreateCheckbox("", 473, 145, 33, 25)
$Checkbox17 = GUICtrlCreateCheckbox("", 472, 81, 33, 25)
$Checkbox18 = GUICtrlCreateCheckbox("", 473, 17, 33, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("确定(&O)", 113, 251, 75, 25)
$Button2 = GUICtrlCreateButton("取消(&C)", 330, 251, 75, 25)
$Label19 = GUICtrlCreateLabel("软件安装倒计时", 176, 216, 109, 17)
GUICtrlSetFont(-1, 10, 800, 0, "楷体_GB2312")
$Label20 = GUICtrlCreateLabel("10", 288, 216, 28, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("_timer", 1000)
Func _timer()

        $time -= 1

       GUICtrlSetData($Label20, ""&$time&"秒" )

        If $time <= 0 Then

$time = 1

        ControlClick("装机软件选择", "确定(&O)", "Button21" )
                        ;Exit
               
                ENDif
        EndFunc   ;==>_timer
Local $Checkbox
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $Button1
                        Local $bool = False
                        For $i = 1 To 19
                                $t = "checkbox" & $i
                                If GUICtrlRead(Eval($t)) = $GUI_CHECKED Then
                                        $bool = True
                                        setup($i)
                                                                        EndIf
                                                                         Next                       
                Exit
        Case $Button2
                Exit
        EndSwitch
WEnd
Func setup($i)
        Switch $i
                Case 1
IniWrite("tkboy.ini", "项", "一键Ghost", 1 )
                Case 2
IniWrite("tkboy.ini", "项", "QQ", 1 )       
                Case 3
IniWrite("tkboy.ini", "项", "迅雷", 1 )                        
                Case 4
IniWrite("tkboy.ini", "项", "手机助手", 1 )
                Case 5
IniWrite("tkboy.ini", "项", "看图王", 1 )
                Case 6
IniWrite("tkboy.ini", "项", "好压", 1 )         
                Case 7
IniWrite("tkboy.ini", "项", "360杀毒", 1 )
                Case 8
IniWrite("tkboy.ini", "项", "360安全卫士", 1 )  
                Case 9
IniWrite("tkboy.ini", "项", "360浏览器", 1 )
                Case 10
IniWrite("tkboy.ini", "项", "酷我音乐", 1 )   
                Case 11
IniWrite("tkboy.ini", "项", "百度输入法", 1 )
                Case 12
IniWrite("tkboy.ini", "项", "百度浏览器", 1 )  
                Case 13
IniWrite("tkboy.ini", "项", "暴风影音", 1 )
                Case 14
IniWrite("tkboy.ini", "项", "酷狗音乐", 1 )  
                Case 15
IniWrite("tkboy.ini", "项", "PPTV", 1 )
                Case 16
IniWrite("tkboy.ini", "项", "爱奇艺", 1 )
                Case 17
IniWrite("tkboy.ini", "项", "PPT美化", 1 )        
                Case 18
IniWrite("tkboy.ini", "项", "WPS", 1 )                                               
                                        EndSwitch
                                                
        EndFunc
        Func _end()
         
                ;MsgBox(48, '', '所有软件这安装结束!',3)
                Exit
               
                EndFunc
如果说我手动点了哪个地方,然后就能让倒计时消失或者停止了。
我想根据ini来判断勾选框是否打勾,GUICtrlCreateCheckbox这个函数应该怎么读取ini?
 楼主| 发表于 2015-1-17 16:48:24 | 显示全部楼层
本帖最后由 tk390480 于 2015-1-17 16:50 编辑

关于暂停倒计时的,我也看过http://zhidao.baidu.com/link?url ... ap-wvUP2GCT2h6A0Z5q
可是按照他的话会出错,比如加了这个#Include <Misc.au3>以后就出错。

论坛上其他的代码用了说未声明全局变量,实在是找不到解决方法了。
发表于 2015-1-17 17:03:17 | 显示全部楼层
AdlibUnRegister ("_timer")行吗?
需要再注册

评分

参与人数 1金钱 +15 收起 理由
tk390480 + 15

查看全部评分

 楼主| 发表于 2015-1-17 17:09:22 | 显示全部楼层
回复 3# zhouhaijin


    我试试
 楼主| 发表于 2015-1-17 17:49:18 | 显示全部楼层
本帖最后由 tk390480 于 2015-1-17 17:52 编辑

回复 3# zhouhaijin


    哎,试了这么久才知道这个该放在哪个位置orz,果然好用。

怎么设置已解决?虽然还有个问题没解决但这个倒计时主题算是解决了。
发表于 2015-1-17 21:53:46 | 显示全部楼层
AdlibUnRegister
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-23 12:39 , Processed in 0.105073 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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