Hello,
I'm looking for some help creating a simple overlay countdown timer that sits in a specified corner of my screen. Basically, I need it to count down from 5 everytime I press "R", then reset automatically. If possible, and not too complicated, the ability to change the color and size of the text would be awesome!
I'm very new to all of this and have been researching and Googling, but creating it from scratch seems quite daunting as I have zero experience. Links specific and helpful to this inquiry are also much appreciated!
Cheers
EDIT... I have found this: https://bytefreaks.net/applications/on- ... ource-code, and maybe editing it could be the easiest way to complete this for a newbie like myself. Any help much appreciated!
Overlay Countdown Timer
Re: Overlay Countdown Timer
Just a quick adaption from an existing code : https://autohotkey.com/board/topic/1815 ... ding-time/
; https://autohotkey.com/board/topic/1815 ... ding-time/
;On-screen display (OSD)
CustomColor = 99AA55 ; Can be any RGB color (it will be made transparent below).
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Color, %CustomColor%
Gui, Font, s32 ; Set a large font size (32-point).
Gui, Add, Text, vMyText cBlue, 00 ; 00 serve to auto-size the window.
WinSet, TransColor, %CustomColor% ; Make all pixels of this color transparent
Gui, Show, x0 y80 NoActivate ; NoActivate avoids deactivating the currently active window.
return
r:: ; hotkey r will start or reset counting
counter:=0
SetTimer, UpdateOSD, -10 ; to update immediately
SetTimer, UpdateOSD, 1000
return
UpdateOSD:
counter++
time_display:=6-counter ; 6 and not 5 because counter starts with 1
if (time_display=0)
SetTimer, UpdateOSD, off ; stops the counter
GuiControl,, MyText, %time_display%
return
esc::exitapp
; https://autohotkey.com/board/topic/1815 ... ding-time/
;On-screen display (OSD)
CustomColor = 99AA55 ; Can be any RGB color (it will be made transparent below).
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Color, %CustomColor%
Gui, Font, s32 ; Set a large font size (32-point).
Gui, Add, Text, vMyText cBlue, 00 ; 00 serve to auto-size the window.
WinSet, TransColor, %CustomColor% ; Make all pixels of this color transparent
Gui, Show, x0 y80 NoActivate ; NoActivate avoids deactivating the currently active window.
return
r:: ; hotkey r will start or reset counting
counter:=0
SetTimer, UpdateOSD, -10 ; to update immediately
SetTimer, UpdateOSD, 1000
return
UpdateOSD:
counter++
time_display:=6-counter ; 6 and not 5 because counter starts with 1
if (time_display=0)
SetTimer, UpdateOSD, off ; stops the counter
GuiControl,, MyText, %time_display%
return
esc::exitapp
-
- Posts: 2
- Joined: 27 Oct 2018, 13:52
Re: Overlay Countdown Timer
This is almost perfect!
I messed with the settings to get it just to my liking. The only problem is it won't let me use R in any other program when the script is running. Is there a way to fix that? I need it to overlay all other programs, but not interfere with the R button.
Also, if I need to slightly change the timing (say reduce the milliseconds per count, is that possible? I don't know if I will need this option because I cannot use it in the program I need quite yet, but it would be nice to know in that case.
Thank you! Your help is much appreciated
I messed with the settings to get it just to my liking. The only problem is it won't let me use R in any other program when the script is running. Is there a way to fix that? I need it to overlay all other programs, but not interfere with the R button.
Also, if I need to slightly change the timing (say reduce the milliseconds per count, is that possible? I don't know if I will need this option because I cannot use it in the program I need quite yet, but it would be nice to know in that case.
Thank you! Your help is much appreciated
Re: Overlay Countdown Timer
To change the counter timing:
https://autohotkey.com/docs/commands/SetTimer.htm
To change the hotkey action:
https://autohotkey.com/docs/Tutorial.htm#s2
https://autohotkey.com/docs/commands/SetTimer.htm
To change the hotkey action:
https://autohotkey.com/docs/Tutorial.htm#s2
-
- Posts: 1
- Joined: 17 Jan 2022, 03:42
Re: Overlay Countdown Timer
Super late but this for anyone in the future wondering. I usually add a hotkey to suspend the script and suspend the hotkeys. Ex:ItzScience wrote: ↑29 Oct 2018, 12:17This is almost perfect!
I messed with the settings to get it just to my liking. The only problem is it won't let me use R in any other program when the script is running. Is there a way to fix that? I need it to overlay all other programs, but not interfere with the R button.
Also, if I need to slightly change the timing (say reduce the milliseconds per count, is that possible? I don't know if I will need this option because I cannot use it in the program I need quite yet, but it would be nice to know in that case.
Thank you! Your help is much appreciated
Code: Select all
F5::
Suspend, Toggle ;Pressing this suspends the hotkeys so youd be able to press r everywhere else(in ur case that is)
return
Pause::Pause ;Pauses the script completely so it wouldnt do anything anymore.