Jump to content

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

[Solved] Make a Countdown in Tooltip



  • Please log in to reply
7 replies to this topic
Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012
Hi!


Im doing the following script by Tooltip

^q::

Tooltip, 10
Sleep, 1000
Tooltip, 9
Sleep, 1000
Tooltip, 8
Sleep, 1000
Tooltip, 7
Sleep, 1000
Tooltip, 6
Sleep, 1000
Tooltip, 5
Sleep, 1000
Tooltip, 4
Sleep, 1000
Tooltip, 3
Sleep, 1000
Tooltip, 2
Sleep, 1000
Tooltip, 1
Sleep, 1000
Tooltip, 0
exitapp

Already i seached in forums but I only found Countdowns in Msgbox, or Gui

So the questions are
How i can do it more efficiently and capable to set a variable of the secs of the countdown that I want?
Ex: 10 secs, 30 secs, etc
And How I do it backwards:
Ex: 0 to 10, 0 to 30 ?

Thanks and sorry


  • Guests
  • Last active:
  • Joined: --
✓  Best Answer
Look into loops, here is an example
^q::
Loop 10
	{
	 ToolTip, % 11 - A_Index ; if you just use A_Index it starts at 1 2 3 etc
	 Sleep 1000
	}
Tooltip, 0
exitapp
Return
No need to be sorry.
Another way could be a SetTimer but that depends if you want to do other things while the tooltip is running

Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012
thank u very much!!! =D

;VARIABLES
CountTime = 10 

^q::
Loop %CountTime%
   {
    ToolTip, % CountTime - A_Index ; if you just use A_Index it starts at 1 2 3 etc
    Sleep 1000
   }
Tooltip, 0
exitapp
Return

xd

Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012
Wait.. if i use SetTimer the count dont change:
it stays on number 11

^q::
Settimer, Counter, 1000

Counter:
   {
    ToolTip, % 11 - A_Index ; if you just use A_Index it starts at 1 2 3 etc
   }
   return



dmg
  • Members
  • 2395 posts
  • Last active: Nov 04 2015 06:46 AM
  • Joined: 19 Nov 2010
I believe he meant you could create another script which could use a SetTimer instead of a Loop. The script he provided will only work with a loop because the A_Index variable only functions to create a count when it is inside a loop.
"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion

-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact

Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012

I believe he meant you could create another script which could use a SetTimer instead of a Loop. The script he provided will only work with a loop because the A_Index variable only functions to create a count when it is inside a loop.


Ya, I'm now thinking the same. lol

Ok, by trying by myself I finded a way to count 0 to 10 with settimer.

^q::
Settimer, Counter, 1000

Counter: 
{
Var++
Tooltip, %Var%`n
}

if var = 10
{
    settimer, counter, off
    tooltip
}

Now Im relooking for do this with countdown

Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012
Ok i did it with countdown :D

^q::
Settimer, Counter, 1000

Var := 10

Counter: 
{
Var--
Tooltip, %Var%`n
}

if var = 0
{
    settimer, counter, off
    tooltip
}


  • Guests
  • Last active:
  • Joined: --
Looks like you're getting the hang of it :D