找回密码
 加入
搜索
查看: 5812|回复: 6

帮忙写个AU3么 倒计时执行程序,ESC取消 !

  [复制链接]
发表于 2008-9-25 08:48:38 | 显示全部楼层 |阅读模式
倒计时执行程序,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 编辑 ]
发表于 2008-9-25 13:38:14 | 显示全部楼层
HotKeySet("{ESC}", "exitprogram")
While 1
sleep(10000)
filedelete("e:\maxbak\sys.gho")
Run ("icafe8.exe")
Exit
WEnd

Func Exitprogram()
Exit
Endfunc
发表于 2008-9-25 15:02:25 | 显示全部楼层
#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 编辑 ]
发表于 2008-9-25 16:54:54 | 显示全部楼层

#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 编辑 ]
 楼主| 发表于 2008-9-25 23:59:21 | 显示全部楼层
原帖由 palkiller 于 2008-9-25 15:02 发表
#include
$Form1= GUICreate("系统自动恢复程序",320, 240)
$lable1=GUICtrlCreateLabel("说明"&@lf&" ---------------------------------------------------"&@LF&"10秒后将自动重启进行系统的还原,"&@lf&@lf& ...


能做成带进度条的么。
您写的代码我编译了,是这个效果,呵呵!

[ 本帖最后由 piaomusic 于 2008-9-26 00:02 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-9-26 02:31:50 | 显示全部楼层
可以做进度条...明早给你脚本... 写脚本到现在...困死俺了...
发表于 2008-9-26 07:04:36 | 显示全部楼层

进度条系统自动恢复程序

#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
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-7 00:51 , Processed in 0.086461 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表