[AHK]簡單實現倒計時工具

 

 

 

 

;整理自 https://autohotkey.com/board/topic/8755-timer-display/
allowedMinutes := 15
endTime := A_Now
endTime += %allowedMinutes%, Minutes

Gui Font, s48 w800 c8000FF, Bookman Old Style
Gui Add, Text, w320 h72 x10 y10 center vtime
Gui Show, w340 h100, Time is running out!
SetTimer TicTac, 1000
; Fallthrough

TicTac:
   remainingTime := endTime
   EnvSub remainingTime, %A_Now%, Seconds
   h := remainingTime // 60 // 60
   m := remainingTime // 60
   s := Mod(remainingTime, 60)
   displayedTime := Format2Digits(h) ":" Format2Digits(m) ":" Format2Digits(s)
   GuiControl, , time, %displayedTime%
   if displayedTime = 00:00:00
  {
    MsgBox, 0, , You're Pre-Paid Time is Spent,2
    gosub, exitsub
  }
Return


exitsub:
GuiClose:
GuiEscape:
ExitApp

Format2Digits(_val)
{
   _val += 100
   StringRight _val, _val, 2
   Return _val
}
Return
 
發佈了333 篇原創文章 · 獲贊 269 · 訪問量 288萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章