Jump to content

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

[Solved] Check if the Label is running or not In this Script



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

By searching in forums I found a Countdown Timer that works at TrayTip and im actually using him
[color=#008000]#Persistent

^q::
C = %A_TickCount%
CountDown = 000006  ; 6 digits = HHmmSS
Settimer, ShowTime
ShowTime:
{
   T = 20000101%CountDown%
   T += (C-A_TickCount)/1000,Seconds
   FormatTime FormdT, %T%, H : mm : ss
   TrayTip,Counter!,%FormdT%
   IfEqual FormdT, 0 : 00 : 00, SetTimer ShowTime, Off
}[/color]

The Problem is that I want to him to run another again if only the previous counter has finished


Already I tried many ways to do this, but I Couldn't find the right one. The last thing I tried was something like this:
But Doesnt Work:
#Persistent

[color=#800000]Timer1 = 0
return
TimerCorrect:
{
    Timer1 = 1
}[/color]

^q::
C = %A_TickCount%
CountDown = 000006  ; 6 digits = HHmmSS
[color=#800000]if (Timer1 = 0){
    Settimer, ShowTime
    goto, TimerCorrect
}[/color]
return

ShowTime:
{
   T = 20000101%CountDown%
   T += (C-A_TickCount)/1000,Seconds
   FormatTime FormdT, %T%, H : mm : ss
   TrayTip,Counter!,%FormdT%
   IfEqual FormdT, 0 : 00 : 00, SetTimer ShowTime, Off
}
return

Basically What I am trying to do is checking if the Label is running, and if is running, do not execute another one until the last one has finished

Thanks and sorry.=)

dylan904
  • Members
  • 706 posts
  • Last active: Nov 14 2016 06:17 PM
  • Joined: 18 Jan 2012
✓  Best Answer
Give this a try...
#Persistent



^q::

if (!Timer1){                       ;~ Only assign the variables below if the timer is off, or else it will interfere with the current timer.

   C = %A_TickCount% 

   CountDown = 000006  ; 6 digits = HHmmSS

   Settimer, ShowTime

   Timer1 := True

}

return



ShowTime:

T = 20000101%CountDown%

T += (C-A_TickCount)/1000,Seconds

FormatTime FormdT, %T%, H : mm : ss

TrayTip,Counter!,%FormdT%

IfEqual FormdT, 0 : 00 : 00

{  

   Timer1 := False                  ;~ You have to inform the script that the last timer has ended.

   SetTimer ShowTime, Off

}

return


Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012
:DD
Works!!
Thanks u!!!

Where I can find more about that exclamations marks type of codes?
like
if ([color=#FF0000]![/color]Timer1)
or
False
and
True

its done anyways!
Thank u very much!!! =D

dylan904
  • Members
  • 706 posts
  • Last active: Nov 14 2016 06:17 PM
  • Joined: 18 Jan 2012
False is the same as assigning it to 0, True is the same as assigning it to 1. It is just more clear as to what you are trying to do when you assign them like this.

The prefix "!" is to specify NOT, meaning it is not true, and is either 0 or blank, removing the need to assign timer1 at the beginning of your script.

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

False is the same as assigning it to 0, True is the same as assigning it to 1. It is just more clear as to what you are trying to do when you assign them like this.

The prefix "!" is to specify NOT, meaning it is not true, and is either 0 or blank, removing the need to assign timer1 at the beginning of your script.


Kk!!
Thank u Dylan! this will help me very much!

dylan904
  • Members
  • 706 posts
  • Last active: Nov 14 2016 06:17 PM
  • Joined: 18 Jan 2012
Glad to help.
If you have no further questions regarding this post please add the [Solved] prefix to the title so that we know the issue has been resolved in a sense. Same goes for your post ("Start, Stop and Restart a Loop from the beginning").

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