试试
#include <GUIConstants.au3>
#include <Date.au3>
Global $time1end, $time2end
GUICreate("延迟时间", 300, 250)
GUICtrlCreateGroup("", 20, 20, 260, 90)
$Checkbox1 = GUICtrlCreateCheckbox("第一次", 15, 60, 65, 20)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("时间延迟:", 65, 45)
$wait1 = GUICtrlCreateInput("10", 150, 40, 38, 20)
GUICtrlCreateLabel("秒", 195, 45)
$Label1 = GUICtrlCreateLabel('核弹爆炸倒计时:____秒', 65, 80, 200, 20)
GUICtrlCreateGroup("", 20, 120, 260, 90)
$Checkbox2 = GUICtrlCreateCheckbox("第二次", 15, 160, 65, 20)
GUICtrlCreateLabel("时间延迟:", 65, 145)
$wait2 = GUICtrlCreateInput("15", 150, 140, 38, 20)
GUICtrlCreateLabel("秒", 195, 145)
$Label2 = GUICtrlCreateLabel('核弹爆炸倒计时:____秒', 65, 180, 200, 20)
$okbutton = GUICtrlCreateButton("OK", 120, 220, 60)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $okbutton
If GUICtrlRead($okbutton) = "OK" Then
If GUICtrlRead($Checkbox1) = $gui_checked Then
$time1end = _DateAdd('s', GUICtrlRead($wait1), _NowCalc())
EndIf
If GUICtrlRead($Checkbox2) = $gui_checked Then
$time2end = _DateAdd('s', GUICtrlRead($wait2), _NowCalc())
EndIf
EndIf
AdlibEnable("daojishi")
EndSwitch
WEnd
Func Daojishi()
If GUICtrlRead($Checkbox1) = $gui_checked Then
$t1 = _DateDiff("s", _NowCalc(), $time1end)
If $t1 >= 0 Then
GUICtrlSetData($Label1, '核弹爆炸倒计时:' & $t1 & '秒')
Else
TrayTip('Info', '第一次倒计时时间到!', 5)
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
EndIf
EndIf
If GUICtrlRead($Checkbox2) = $gui_checked Then
$t2 = _DateDiff("s", _NowCalc(), $time2end)
If $t2 >= 0 Then
GUICtrlSetData($Label2, '核弹爆炸倒计时:' & $t2 & '秒')
Else
TrayTip('Info', '第二次倒计时时间到!', 5)
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
EndIf
EndIf
If GUICtrlRead($Checkbox1) = $gui_unchecked And GUICtrlRead($Checkbox2) = $gui_unchecked Then AdlibDisable()
EndFunc ;==>Daojishi |