[auto hot key]GUI倒计时实现

#NoEnv
#SingleInstance,off
SendMode, Input
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%

count:=0

Menu,tray,NoStandard
Menu,tray,Tip, 计时器
Menu,Tray,Add,E&xit,guiclose

Gui,Show, W200 H95 Center,定时器
Gui,Add,Text,vTT x5 y5 w180 Center,%count%
Gui,Add,Text,x5 y25 w180,时间[单位:秒]
Gui,Add,Edit,x5 y40 w190 vtime
Gui,Add,Button,Default x80 y65 w40 h22 gtimer,计时
return

timer:
    ; gui,hide
    Gui Submit,nohide
    count:=time
    GuiControl, ,TT , %count%
    Loop, %time%
    {
        Sleep, 1000
        count:=count-1
        GuiControl, ,TT , %count%
    }
    ; time := time*1000
    ; sleep, %time%
    gosub guiclose

guiclose:
ExitApp

输入时间点击计时,上方会出现一个倒计时样式。

posted @ 2023-05-29 14:22  DwightValentine  阅读(74)  评论(0)    收藏  举报