Global $iWait = 60 * 60 * 5 ;5 hour in sec
HotKeySet('{Esc}', '_Exit')
AdlibRegister('_Until', 1000)
ToolTip(_SecToTimeFormat($iWait), 0, 0)
While $iWait
Sleep(1000)
WEnd
MsgBox(64, 'Info', 'Time ended.')
Exit
Func _Exit()
Exit
EndFunc ;==>_Exit
Func _Until()
$iWait -= 1
ToolTip(_SecToTimeFormat($iWait), 0, 0)
EndFunc ;==>_Until
Func _SecToTimeFormat($i_Time)
Local $i_Hour, $i_Min, $i_Sec, $s_Format = '%02d:%02d'
If $i_Time < 0 Then $i_Time = 0
$i_Hour = Int($i_Time / 3600)
$i_Time = Mod($i_Time, 3600)
$i_Min = Int($i_Time / 60)
$i_Sec = Mod($i_Time, 60)
If $i_Hour Then
Return StringFormat('%02d:' & $s_Format, $i_Hour, $i_Min, $i_Sec)
Else
Return StringFormat($s_Format, $i_Min, $i_Sec)
EndIf
EndFunc ;==>_SecToTimeFormat