循环问题,选第一个就关闭,选两个就死循环了,请教
#include <GUIConstants.au3>GUICreate("延迟时间", 300, 250)
GUICtrlCreateGroup ("",20,20,260,90)
$Checkbox1=GUICtrlCreateCheckbox("第一次", 15, 60, 65, 20)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("时间延迟:", 65,45)
$wait1=GUICtrlCreateInput("0.001",150,40,38,20)
GUICtrlCreateLabel("小时", 195,45)
$Label = GUICtrlCreateLabel('核弹爆炸倒计时:____秒', 65,80,200,20)
GUICtrlCreateGroup ("",20,120,260,90)
$Checkbox2=GUICtrlCreateCheckbox("第二次", 15, 160, 65, 20)
GUICtrlCreateLabel("时间延迟:", 65,145)
$wait2=GUICtrlCreateInput("0.002",150,140,38,20)
GUICtrlCreateLabel("小时", 195,145)
$Labe2 = GUICtrlCreateLabel('核弹爆炸倒计时:____秒', 65,180,200,20)
$okbutton=GUICtrlCreateButton("OK", 120, 220, 60)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
$CH1=1
Else
$CH1=0
EndIf
Case $Checkbox2
If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
$CH2 = 1
Else
$CH2 = 0
EndIf
Case $okbutton
If GUICtrlRead($okbutton) = "OK" Then
If $CH1=0 and $CH2=1 then
MsgBox(0,"","请从第一次选")
ElseIf $CH1=1 and $CH2=0 Then
$w=GUICtrlRead($wait1)*60*60
AdlibEnable("Daojishi")
ElseIf $CH1=1 and $CH2=1 Then
$w=GUICtrlRead($wait1)*60*60
AdlibEnable("Daojishi")
Else
MsgBox(0,"","请选择")
EndIf
EndIf
EndSwitch
WEnd
Func Daojishi()
Local $bg = 0, $C = 0
$T1 = TimerInit()
While 1
$bg = 1
If $bg = 1 Then
$T2 = Int(TimerDiff($T1) / 1000)
If $T2>=$w Then ExitLoop
If $T2 > $C Then
$C = $T2
GUICtrlSetData($Label , '核弹爆炸倒计时: '&$w-$T2&' 秒')
EndIf
EndIf
WEnd
EndFunc
弄了几天了,一直没弄好,请帮忙修改下. 请问上面是用什么语言写的?
就是AUTOIT 3 写的啊
顶下,寻求帮助. 试试#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
大侠谢谢!
能让第一个倒计时走完,再开始走第二个倒计时吗?我中间要插点动作,修改时间后运行某个软件
页:
[1]