I guess my next question is:
Is there a way to cancel the timer once running?
Seems like there's no X so no place for a mouse to do the cancelling.
Can't grab a key, as best I can tell..
Maybe I could mouseover the timer to get a cancel button?
Not really sure how to handle that..
Here's what i have, using your code:
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#persistent
CoordMode, ToolTip, Screen
tt = %1%
;tt = 120
time := Convert_Milliseconds(tt)
Sec := (tt * 60)
SetTimer, nMessage, %time%
countdown(Sec)
return
nMessage:
SetTimer, nMessage, Off
SoundGet, volumeBackup
SoundGet, master_mute, , mute
if master_mute = on
SoundSet, +1, , mute
SoundSet, +100 ;Set it to the highest volume
Gui, +MinimizeBox
GUi, -sysmenu
gui, +toolwindow
Gui, Add, Button, w130, DONE- hit 'O' for OK
Gui, Show, x1 y1, dTIME 1.1
SoundBeep, 500, 100
Sleep 100
SoundBeep, 1500, 100
Sleep 100
SoundBeep, 1500, 100
Sleep 100
SoundBeep, 1500, 100
Sleep 100
SoundBeep, 1500, 100
Sleep 100
SoundBeep, 1500, 100
Sleep 100
SoundBeep, 1500, 100
If master_mute = on ; Restore the volume
SoundSet, +1, , mute
soundset, %volumeBackup%
KeyWait, o, D
Tooltip ,, 2, 980
Gui Destroy
exitapp
Convert_MilliSeconds(time,MS = 1000,M = 60)
{
return MS*M*time
}
countdown(p_count="") {
countdown_time:=p_count
countdown_date=16010101
countdown_date+=%countdown_time%, s
Loop {
If (countdown_date >= 16010101010000){
FormatTime, mmss, %countdown_date%, hh:mm:ss
}else{
FormatTime, mmss, %countdown_date%, mm:ss
}
;msgbox %countdown_date%`n%hhmmss%
;//SB_SetText(mmss, 2)
Tooltip, %mmss%, 2,980
Sleep, 1000
countdown_date+=-1, s
;//IfLess, countdown_date, 16010101, break
if (A_Index>countdown_time) {
break
}
}
}