Ходячая катастрофа
, нужно запустить таймер с фиксированной единицой в зависимости от выбранной галочки (радио) по нажатию на кнопку Старт, с учетом формата выводимого времени "Часы:Минуты:Секунды".
#SingleInstance force
Gui,Add, Text, x70 y30 w100 h25 vtimers, X_X
Gui,Add, Radio ,x15 y30 gtimes vtimestyle1, 1ч
Gui,Add, Radio ,x+10 y30 gtimes vtimestyle2, 2ч
Gui,Add, Radio ,x+10 y30 gtimes vtimestyle3, 5ч
Gui,Add, Radio ,x+10 y30 gtimes vtimestyle4, 8ч
Gui,Add, Text, x85 y55 h25 gstart, Старт
Gui,Show, w180 h80
return
times:
Gui, Submit, NoHide
If timestyle1=1
numbertime:=3600
If timestyle2=1
numbertime:=7200
If timestyle3=1
numbertime:=18000
If timestyle4=1
numbertime:=28800
return
numbertime(Num)
{
Hours := Num // 3600
Num := Mod(Num, 3600)
Min := Num // 60
Sec := Mod(Num, 60)
return Hours " часов, " Min " минут и " Sec " секунд"
}
start:
if(numbertime!=0)
{
SetTimer, lGeneralTimer, off
SetTimer, lUpdateTimer, off
}
StartTime := A_TickCount
SetTimer, lUpdateTimer, 1000
return
UpdateDisplay(numbertime)
{
GuiControl, Text, timers, % NumToTime
}
lGeneralTimer:
SetTimer, lGeneralTimer, off
TrayTip, Внимание!, Таймер завершен, 5, 1
return
lUpdateTimer:
if(StartTime+randbot*1000<=A_TickCount)
{
SetTimer, lGeneralTimer, off
Updatetimers(0)
numbertime := 0
}
else
UpdateDisplay(numbertime-(A_TickCount-StartTime)//1000)
return
End::ExitApp