找回密码
 加入
搜索
查看: 2903|回复: 3

[AU3基础] 倒计时关机

[复制链接]
发表于 2011-1-2 21:45:10 | 显示全部楼层 |阅读模式
我想做个windows bat的命令,关机倒计时关机怎么做啊
shutdown -r -t 30 -c "系统安装完成!30秒后会自动重启!"

转换为 AU3代码
发表于 2011-1-2 23:59:41 | 显示全部楼层
Sleep(30000);运行30秒
$Box = MsgBox(4, "注意", "点击是关机,否取消!");提示对话框
If $Box = 6 Then;如果点击是
        Shutdown(4 + 8);强制+关闭电源
Else;点击否
        Exit;退出程序
EndIf
发表于 2011-1-3 19:44:31 | 显示全部楼层
#include <GUIConstants.au3>
GUICreate("倒计时关机", 250, 150,180,80)
$Button1 = GUICtrlCreateButton("确定(&Y)", 30, 110, 73, 25, 0)
$Button2 = GUICtrlCreateButton("退出(&X)", 150, 110, 73, 25, 0)
GUISetState(@SW_SHOW)

$Label = GUICtrlCreateLabel('倒计时: 10 秒',28,45,250,40)
GUICtrlSetFont(-1, 26, 400, 0, "MS Sans Serif")
Local $C = 0, $w = 10, $T1 = TimerInit()

While 1
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
        $T2 = Int(TimerDiff($T1) / 1000)
        If $T2 >= $w Then ExitLoop
        If $T2 > $C Then
                $C = $T2
        GUICtrlSetData($Label , '倒计时: ' & $w - $T2 & ' 秒')
        EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
ExitLoop
Case $Button2
Exit
EndSwitch
WEnd
_guanji()
Exit

Func _guanji()
shutdown(4+8) 
EndFunc   ;==>_timer
发表于 2011-1-3 20:22:43 | 显示全部楼层
if msgbox(4,"","系统将于30秒后关机,点是立即关机,点否取消关机!",10)=7 then exit
Shutdown(5)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 14:40 , Processed in 0.076582 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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