gxd1112 发表于 2008-10-19 13:01:13

我有个地方要延迟几个小时再往下执行,可执行没法关,怎么跳出延迟?

比如输入时间,想停止运行重新输入后执行.

#include <GUIConstants.au3>
GUICreate("延迟时间", 300, 170)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("时间延迟:", 35,65)
$wait1=GUICtrlCreateInput("3",150,60,38,20)
GUICtrlCreateLabel("小时", 190,65)
$okbutton=GUICtrlCreateButton("OK", 120, 120, 60)
While 1
$Msg=GUIGetMsg()
    Switch $Msg
      Case $GUI_EVENT_CLOSE
            Exit
                Case $okbutton
             $w=GUICtrlRead($wait1)*60*60*1000
                       Sleep($w)
   EndSwitch
WEnd

gxd1112 发表于 2008-10-19 13:28:25

也许弱智,但请告知.

还有,如有两个条件,选一个或两个,再分别执行,怎么弄?

liongodmien 发表于 2008-10-19 13:54:51


#include <GUIConstants.au3>
GUICreate("延迟时间", 300, 170)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("时间延迟:", 35,65)
$wait1=GUICtrlCreateInput("3",150,60,38,20)
GUICtrlCreateLabel("小时", 190,65)
$okbutton=GUICtrlCreateButton("OK", 120, 120, 60)
$Label = GUICtrlCreateLabel('核弹爆炸倒计时:____秒', 65,90,200,20)
Local $bg = 0, $C = 0
While 1
        $Msg=GUIGetMsg()
    Switch $Msg
      Case $GUI_EVENT_CLOSE
            Exit
                Case $okbutton
                        $w=GUICtrlRead($wait1)*60*60
                        $T1 = TimerInit()
                        $bg = 1
        EndSwitch
        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

liongodmien 发表于 2008-10-19 13:57:30

原帖由 gxd1112 于 2008-10-19 13:28 发表 http://www.autoitx.com/images/common/back.gif
还有,如有两个条件,选一个或两个,再分别执行,怎么弄?
看说明的条件判断语句!

如果不去看可以学到东西的帮助,而只是不停的问,那不是其它问题,是懒惰...

liongodmien 发表于 2008-10-19 14:17:53

用HOTKEY的退出办法:

#include <GUIConstants.au3>
GUICreate("延迟时间", 300, 170)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("时间延迟:", 35,65)
$wait1=GUICtrlCreateInput("3",150,60,38,20)
GUICtrlCreateLabel("小时", 190,65)
$okbutton=GUICtrlCreateButton("OK", 120, 120, 60)
HotKeySet('^{F7}', 'QuitQuitQuit')
While 1
$Msg=GUIGetMsg()
    Switch $Msg
      Case $GUI_EVENT_CLOSE
            Exit
                Case $okbutton
                        $w=GUICtrlRead($wait1)*60*60*1000
                        Sleep($w)
   EndSwitch
WEnd

Func QuitQuitQuit()
        Exit
EndFunc

gxd1112 发表于 2008-10-19 14:32:44

谢谢!

万分感谢!总算能编下去了

superflq 发表于 2008-10-21 12:32:02

学习了,谢谢分享
页: [1]
查看完整版本: 我有个地方要延迟几个小时再往下执行,可执行没法关,怎么跳出延迟?