Overlay Countdown Timer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ItzScience
Posts: 2
Joined: 27 Oct 2018, 13:52

Overlay Countdown Timer

Post by ItzScience » 27 Oct 2018, 14:05

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!

trust_me
Posts: 98
Joined: 29 Jul 2017, 10:46

Re: Overlay Countdown Timer

Post by trust_me » 28 Oct 2018, 08:17

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

ItzScience
Posts: 2
Joined: 27 Oct 2018, 13:52

Re: Overlay Countdown Timer

Post by ItzScience » 29 Oct 2018, 12:17

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 :)

trust_me
Posts: 98
Joined: 29 Jul 2017, 10:46

Re: Overlay Countdown Timer

Post by trust_me » 29 Oct 2018, 14:20


CautiousKnights
Posts: 1
Joined: 17 Jan 2022, 03:42

Re: Overlay Countdown Timer

Post by CautiousKnights » 25 Jan 2022, 18:56

ItzScience wrote:
29 Oct 2018, 12:17
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 :)
Super late but this for anyone in the future wondering. I usually add a hotkey to suspend the script and suspend the hotkeys. Ex:

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. 
Hope this is of use for anyone in the future.

Post Reply

Return to “Ask for Help (v1)”