Code: Select all
TimeLimit(i)
{
Global
if i = 0
SetTimer, Clock, off
else
{
tim := i * 60000
;fileappend, %tim%`n, timetest.txt
setTimer, clock, -%tim%
Start := A_TickCount
settimer, stop, 100
}
return
clock:
settimer, stop, off
Done()
Return
stop:
ifWinactive, Ahk_id %Wise%
return
else
{
settimer, clock, off
settimer, stop, off
tim -= A_tickcount - start
winwaitactive, Ahk_id %Wise%
fileappend, %tim%`n, timetest.txt
setTimer, clock, -%tim%
Start := A_TickCount
settimer, stop, 100
}
return
}
Code: Select all
TimeLimit(i)
{
;soundbeep
Start := A_TickCount
if !i
SetTimer, Clock, off
tim := !i ? 0 : i * 1000
if tim != 0
{
setTimer, clock, -%tim%
settimer, stop, 100
}
return
clock:
settimer, stop, off
Done()
Return
stop:
ifWinactive, Ahk_id %Wise%
return
else
{
settimer, clock, off
settimer, stop, off
tim -= A_tickcount - start
winwaitactive, Ahk_id %Wise%
fileappend, %tim%`n, timetest.txt
setTimer, clock, -%tim%
Start := A_TickCount
settimer, stop, 100
}
return
}