-
Notifications
You must be signed in to change notification settings - Fork 3
/
StopTimer.ahk
58 lines (45 loc) · 1.36 KB
/
StopTimer.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;Written By Arekusei and AHK community
;Version 1.2
#SingleInstance Force
#NoEnv
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
Loop, 59
var := var A_Index "|"
Gui, Margin, 0 0
Gui, Add, Text, x5 y20 w50 h20 Center, Hour
Gui, Add, Text, xp+40 yp w50 h20 Center, Min
Gui, Add, Text, xp+40 yp w50 h20 Center, Sec
Gui, Add, ComboBox, x15 y40 w35 h20 va1 r20, 0||%var%
Gui, Add, ComboBox, xp+40 y40 w35 h20 va2 r20, 0||%var%
Gui, Add, ComboBox, xp+40 y40 w35 h20 va3 r20, 0||%var%
Gui, Add, Button, xp+40 y39 w35 h23 gStart, Start
Gui, Add, Text, x5 y100 w200 h20 vDisplay, Time: 00:00:00
Gui, Add, Text, x5 y120 w200 h20 vDisplay2, Time: 00:00:00
Gui, Add, GroupBox, x5 y5 w180 h70 -Theme,
Gui, Show, w190 h150, Set Timer
Return
Start:
Gui, Submit, Nohide
ST := A_TickCount
Time := (a1*3600)+(a2*60)+a3
ET := ST + (Time * 1000)
SetTimer, Stopwatch, 100
return
StopWatch:
GuiControl, , Display, % ToDigital(A_TickCount - ST) ;Time count up
GuiControl, , Display2, % ToDigital(ET - (A_TickCount-1000)) ;Time count down
if (A_TickCount > ET){
MsgBox DONE
SetTimer, Stopwatch, Off
}
Return
ToDigital(currentTime) {
s := Mod(Floor(currentTime / 1000), 60)
m := Mod(Floor(currentTime / (1000 * 60)), 60)
h := Floor(currentTime / (1000 * 60 * 60))
return Format("Time: {:02d}:{:02d}:{:02d}", h, m, s)
}
GuiEscape:
GuiClose:
ExitApp