Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Simple countdown timer


  • Please log in to reply
26 replies to this topic
LightningBAWS
  • Members
  • 1 posts
  • Last active: Mar 31 2015 11:37 AM
  • Joined: 26 Mar 2015

In case anyone wanted a simple count up timer:

 

SetTimer, Timed, 50

Timed:
++curTime
timed := round(CurTime/20, 1)
ToolTip, %timed%

 



Jensen
  • Members
  • 2 posts
  • Last active: Jun 09 2015 07:41 PM
  • Joined: 09 Jun 2015

 

Added the ability to enter a MM:SS start time. If you press enter without entering a time, it will count up. Plays a sound when done counting down and then starts to count up (fixed this).  Pauses if you press press P.  Restarts if you press S. Counts up in red but only after a count down.

Progress, m1 b fs70 fm12 zh10 CTgreen w250, % "00:00", Enter start time
loop,4
    {
    Input x, L1,{esc}{enter},1,2,3,4,5,6,7,8,9,0
    w .= x , y := SubStr("000" w, -3)
    if (ErrorLevel = "Match")
        Progress, m1 b fs70 fm12 zh10 CTgreen w250, % SubStr(y,1,2) ":" SubStr(y,3,2), Enter to accept and start
    else if (Errorlevel = "EndKey:enter")
        break
    else
        exitapp
    }
startover:
t := 0, w := SubStr(y,1,2)*60 + SubStr(y,3,2)
settimer,label,1000
return
label:
++t
if (t < w)
    Progress, % 100*(w-t)/w, % SubStr("00" floor((w-t)/60),-1) ":" SubStr("00" mod(w-t,60),-1), count down
else if (t = w)
    {
    Progress, m1 b fs70 fm12 zh10 CTred w250, 0, Done!
    SoundPlay, *48
    }
else if (t > w)
    Progress, , % SubStr("0" floor((t-w)/60), -1) ":" SubStr("0" mod(t-w,60), -1), count up
p:: settimer,label,% (a:=!a) ? "off" : "on"
s:: goto startover
esc:: ExitApp

would anyone be able to point out how i could change the background of this GUI from white to transparent?

thanks in advance



bruno
  • Members
  • 635 posts
  • Last active: Nov 04 2015 02:26 PM
  • Joined: 07 Mar 2011

can you modify this code so that it gives the user 2 options: 1. to Count UP and 2. to Count Down?



flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009

Could you try this?:

Progress, m1 b fs70 fm12 zh10 CTgreen CWFFFFFF w250, % "00:00", Enter start time, Countdowner
WinSet, TransColor, FFFFFF 255, Countdowner
loop,4
    {
    Input x, L1,{esc}{enter},1,2,3,4,5,6,7,8,9,0
    w .= x , y := SubStr("000" w, -3)
    if (ErrorLevel = "Match")
        Progress, m1 b fs70 fm12 zh10 CTgreen CWFFFFFF w250, % SubStr(y,1,2) ":" SubStr(y,3,2), Enter to accept and start, Countdowner
    else if (Errorlevel = "EndKey:enter")
        break
    else
        exitapp
    WinSet, TransColor, FFFFFF 255, Countdowner
    }

startover:
t := 0, w := SubStr(y,1,2)*60 + SubStr(y,3,2)
settimer,label,1000
return
label:
++t
if (t < w)
    Progress, % 100*(w-t)/w, % SubStr("00" floor((w-t)/60),-1) ":" SubStr("00" mod(w-t,60),-1), count down, Countdowner
else if (t = w)
    {
    Progress, m1 b fs70 fm12 zh10 CTred CWFFFFFF w250, 0, Done!, Countdowner
    SoundPlay, *48
    }
else if (t > w)
    Progress, , % SubStr("0" floor((t-w)/60), -1) ":" SubStr("0" mod(t-w,60), -1), count up, Countdowner
WinSet, TransColor, FFFFFF 255, Countdowner
return

p:: settimer,label,% (a:=!a) ? "off" : "on"
s:: goto startover
esc:: ExitApp

Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009

@bruno: it already does have that feature: just enter (without inputing a #)


Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


Jensen
  • Members
  • 2 posts
  • Last active: Jun 09 2015 07:41 PM
  • Joined: 09 Jun 2015

Thanks so much that's perfect! much appreciated! 



bruno
  • Members
  • 635 posts
  • Last active: Nov 04 2015 02:26 PM
  • Joined: 07 Mar 2011

Thanks, got it after several tries! ;)



Reggie
  • Members
  • 2 posts
  • Last active: Jun 26 2015 12:14 AM
  • Joined: 23 Jun 2015

 

Could you try this?:

Progress, m1 b fs70 fm12 zh10 CTgreen CWFFFFFF w250, % "00:00", Enter start time, Countdowner
WinSet, TransColor, FFFFFF 255, Countdowner
loop,4
    {
    Input x, L1,{esc}{enter},1,2,3,4,5,6,7,8,9,0
    w .= x , y := SubStr("000" w, -3)
    if (ErrorLevel = "Match")
        Progress, m1 b fs70 fm12 zh10 CTgreen CWFFFFFF w250, % SubStr(y,1,2) ":" SubStr(y,3,2), Enter to accept and start, Countdowner
    else if (Errorlevel = "EndKey:enter")
        break
    else
        exitapp
    WinSet, TransColor, FFFFFF 255, Countdowner
    }

startover:
t := 0, w := SubStr(y,1,2)*60 + SubStr(y,3,2)
settimer,label,1000
return
label:
++t
if (t < w)
    Progress, % 100*(w-t)/w, % SubStr("00" floor((w-t)/60),-1) ":" SubStr("00" mod(w-t,60),-1), count down, Countdowner
else if (t = w)
    {
    Progress, m1 b fs70 fm12 zh10 CTred CWFFFFFF w250, 0, Done!, Countdowner
    SoundPlay, *48
    }
else if (t > w)
    Progress, , % SubStr("0" floor((t-w)/60), -1) ":" SubStr("0" mod(t-w,60), -1), count up, Countdowner
WinSet, TransColor, FFFFFF 255, Countdowner
return

p:: settimer,label,% (a:=!a) ? "off" : "on"
s:: goto startover
esc:: ExitApp

Could you please tell me how I can make the GUI start and remain in the corner of the screen in a previous post you mentioned to

"Add a line like wdth := A_ScreenWidth - 350, hght := A_ScreenHeight - 250 and add X%wdth% Y%hght% to the progress options and it will show in the right hand corner."

but I can't work out how to incorporate that line into the code (although I will keep trying!)

 



flyingDman
  • Spam Officer
  • 2186 posts
  • Last active: Nov 07 2015 08:15 AM
  • Joined: 27 Feb 2009

Does this work?

wdth := A_ScreenWidth - 350, hght := A_ScreenHeight - 250

Progress, b2 fs70 fm12 zh10 CTgreen CWFFFFFF  X%wdth% Y%hght% w250, % "00:00", Enter start time, Countdowner
WinSet, TransColor, FFFFFF 255, Countdowner
loop,4
    {
    Input x, L1,{esc}{enter},1,2,3,4,5,6,7,8,9,0
    w .= x , y := SubStr("000" w, -3)
    if (ErrorLevel = "Match")
        Progress, b2 fs70 fm12 zh10 CTgreen CWFFFFFF  X%wdth% Y%hght%  w250, % SubStr(y,1,2) ":" SubStr(y,3,2), Enter to accept and start, Countdowner
    else if (Errorlevel = "EndKey:enter")
        break
    else
        exitapp
    WinSet, TransColor, FFFFFF 255, Countdowner
    }

startover:
t := 0, w := SubStr(y,1,2)*60 + SubStr(y,3,2)
settimer,label,1000
return
label:
++t
if (t < w)
    Progress, % 100*(w-t)/w, % SubStr("00" floor((w-t)/60),-1) ":" SubStr("00" mod(w-t,60),-1), count down, Countdowner
else if (t = w)
    {
    Progress, m1 b fs70 fm12 zh10 CTred CWFFFFFF X%wdth% Y%hght%  w250, 0, Done!, Countdowner
    SoundPlay, *48
    }
else if (t > w)
    Progress, , % SubStr("0" floor((t-w)/60), -1) ":" SubStr("0" mod(t-w,60), -1), count up, Countdowner
WinSet, TransColor, FFFFFF 255, Countdowner
return

p:: settimer,label,% (a:=!a) ? "off" : "on"
s:: goto startover
esc:: ExitApp

Marine Corps Gen. Joseph Dunford told senators at his Joint Chiefs of Staff confirmation hearing : “If you want to talk about a nation that could pose an existential threat to the United States, I'd have to point to Russia. And if you look at their behavior, it's nothing short of alarming.”


Reggie
  • Members
  • 2 posts
  • Last active: Jun 26 2015 12:14 AM
  • Joined: 23 Jun 2015

that's great! thanks flyingDman!!!!



Abrin
  • Members
  • 50 posts
  • Last active: Aug 16 2016 03:24 AM
  • Joined: 19 Jan 2014

 

Added the ability to enter a MM:SS start time. If you press enter without entering a time, it will count up. Plays a sound when done counting down and then starts to count up (fixed this).  Pauses if you press press P.  Restarts if you press S. Counts up in red but only after a count down.

Progress, m1 b fs70 fm12 zh10 CTgreen w250, % "00:00", Enter start time
loop,4
    {
    Input x, L1,{esc}{enter},1,2,3,4,5,6,7,8,9,0
    w .= x , y := SubStr("000" w, -3)
    if (ErrorLevel = "Match")
        Progress, m1 b fs70 fm12 zh10 CTgreen w250, % SubStr(y,1,2) ":" SubStr(y,3,2), Enter to accept and start
    else if (Errorlevel = "EndKey:enter")
        break
    else
        exitapp
    }
startover:
t := 0, w := SubStr(y,1,2)*60 + SubStr(y,3,2)
settimer,label,1000
return
label:
++t
if (t < w)
    Progress, % 100*(w-t)/w, % SubStr("00" floor((w-t)/60),-1) ":" SubStr("00" mod(w-t,60),-1), count down
else if (t = w)
    {
    Progress, m1 b fs70 fm12 zh10 CTred w250, 0, Done!
    SoundPlay, *48
    }
else if (t > w)
    Progress, , % SubStr("0" floor((t-w)/60), -1) ":" SubStr("0" mod(t-w,60), -1), count up
p:: settimer,label,% (a:=!a) ? "off" : "on"
s:: goto startover
esc:: ExitApp

This is truly awesome! Thank you so much. :)



yrtsh
  • Members
  • 13 posts
  • Last active: Apr 10 2018 09:21 AM
  • Joined: 11 Feb 2015

little count down I found to show the sleep delay (show near the mouse is)

;;;;;;;;;;;;;;;;;;SHOW COUNT DONWN near the mouse
Loop 20
{
ToolTip, % 21 - A_Index ; if you just use A_Index it starts at 1 2 3 etc
Sleep 1000
}
Tooltip, 0