帮忙写个AU3么 倒计时执行程序,ESC取消 !
倒计时执行程序,ESC取消 !谢谢 !!@ECHO OFF
@mode con cols=70 lines=20
title 系统自动恢复程序
color a
@ ECHO.
@ ECHO.
@ ECHO. 说 明
@ ECHO ---------------------------------------------------
@ ECHO 10秒后将自动重启进行系统的还原,要取消请关闭该窗口!
ping 127.0.0.1 -n 10>nul
del /q e:\maxbak\sys.gho
start icafe8.exe
exit
[ 本帖最后由 piaomusic 于 2008-9-25 23:57 编辑 ] HotKeySet("{ESC}", "exitprogram")
While 1
sleep(10000)
filedelete("e:\maxbak\sys.gho")
Run ("icafe8.exe")
Exit
WEnd
Func Exitprogram()
Exit
Endfunc #include <GuiConstants.au3>
$Form1= GUICreate("系统自动恢复程序",320, 240)
$lable1=GUICtrlCreateLabel("说明"&@lf&" ---------------------------------------------------"&@LF&"10秒后将自动重启进行系统的还原,"&@lf&@lf&"取消请按esc!",20,40,280,120,0x01)
GUICtrlSetFont($lable1, 10, 400, 0, "宋体")
$timer_start=TimerInit()
$lable2=GUICtrlCreateLabel("",20,180,280,30,0x01)
GUICtrlSetFont($lable2, 20, 400, 0, "隶书")
GUISetState(@SW_SHOW)
$pass=0
HotKeySet("{esc}","esc")
do
$time_pass=TimerDiff($timer_start)
$i=int($time_pass/1000-$pass)
$pass=Int($time_pass/1000)
if $i=1 Then
GUICtrlSetData($lable2,"已过"&$pass&"秒")
EndIf
until $pass=10
while 1
$msg = GUIGetMsg()
_start()
exit
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Func esc()
Exit
EndFunc
Func _start()
GUIDelete($Form1)
if FileExists("e:\maxbak\sys.gho")=1 Then FileDelete("e:\maxbak\sys.gho")
run("icafe8.exe")
EndFunc
[ 本帖最后由 palkiller 于 2008-9-25 17:56 编辑 ]
#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 编辑 ] 原帖由 palkiller 于 2008-9-25 15:02 发表 http://www.autoitx.com/images/common/back.gif
#include
$Form1= GUICreate("系统自动恢复程序",320, 240)
$lable1=GUICtrlCreateLabel("说明"&@lf&" ---------------------------------------------------"&@LF&"10秒后将自动重启进行系统的还原,"&@lf&@lf& ...
能做成带进度条的么。
您写的代码我编译了,是这个效果,呵呵!
[ 本帖最后由 piaomusic 于 2008-9-26 00:02 编辑 ] 可以做进度条...明早给你脚本...:face (9): 写脚本到现在...困死俺了...:face (13):
进度条系统自动恢复程序
#include <GUIConstants.au3>Opt("TrayIconHide", 1)
HotKeySet("{Esc}", "quit")
Func quit()
Exit
EndFunc
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("系统自动恢复程序", 350, 184, 292, 209)
$lable1=GUICtrlCreateLabel("说明"&@lf&" ---------------------------------------------------"&@LF&"10秒后将自动重启进行系统的还原,"&@lf&@lf&"取消请按esc!",35,20,280,120,0x01)
GUICtrlSetFont($lable1, 10, 400, 0, "宋体")
$Progress1 = GUICtrlCreateProgress(26, 135, 295, 30)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$time=10
AdlibEnable("djs", 10 * $time)
$wait = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_CLOSE
mr()
EndSwitch
WEnd
;<strong><font color="#FF0000">倒计时</font></strong>
Func djs()
GUICtrlSetData($Progress1, $wait)
$wait = $wait + 1
If $wait = 101 Then mr()
EndFunc
Func mr()
GUIDelete($Form1)
if FileExists("e:\maxbak\sys.gho")=1 Then FileDelete("e:\maxbak\sys.gho")
run("icafe8.exe")
EndFunc
页:
[1]