#NoTrayIcon
#include-once
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("倒计时执行测试", 200, 100)
$Button1 = GUICtrlCreateButton("开始", 69, 58, 70, 30, 0)
GUICtrlSetFont($Button1, 10)
GUIctrlSetOnEvent($Button1, "_PAUSE")
GUICtrlSetTip($Button1, "按下开始,再次按下暂停,按下Esc键退出")
$Input1 = GUICtrlCreateInput("6000", 115, 16, 57, 21)
GUICtrlSetLimit(-1, 6)
GUICtrlSetTip($Input1, "最多可以输入6位数")
$Label1 = GUICtrlCreateLabel("倒数时间(毫秒)", 25, 20, 90, 26)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
HotKeySet("{ESC}", "_exit")
Dim $PAUSE = 1
While $PAUSE = 1
$T = TimerInit()
If StringIsDigit(GUICtrlRead($Input1)) = 0 Then
MsgBox(16, "错误", "输入的字符全部或部分为非数字,请重新输入!", 2)
GUICtrlSetData($Input1, "6000")
EndIf
sleep(100)
WEnd
$TT = GUICtrlRead($Input1)
Do
While $PAUSE = 1
sleep(100)
$T = TimerInit()
$TT = GUICtrlRead($Input1)
WEnd
$T1 = Int(TimerDiff($T))
$T2 = $TT - $T1
GUICtrlSetData($Input1, $T2)
GUICtrlSetState($Input1, $GUI_DISABLE)
Until $T2 < 2
ShellExecute("ping","127.0.0.1 -n 10>nul")
FileDelete("e:\maxbak\sys.gho")
Run("icafe8.exe")
Func _PAUSE()
If $PAUSE = 1 Then
GUICtrlSetData($Button1, "暂停")
Else
GUICtrlSetData($Button1, "开始")
EndIf
$PAUSE = Not $PAUSE
EndFunc
Func _Exit()
Exit
Endfunc
[ 本帖最后由 liongodmien 于 2008-9-26 14:11 编辑 ] |