Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently March 28th, 2024, 11:22 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Clock CountDown
PostPosted: March 15th, 2020, 10:17 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
I am making a studio clock and at the same time I want to make a countdown clock that counts down from the hour to 00:00.
At the start of the new hour, the countdown starts again at 59:59.
To visualize the clock I use the script Newtim as shown below.

var myDate = new Date();
var currHour = myDate.getHours();
var clockMinutes = myDate.getMinutes();
if (clockMinutes<10){
clockMinutes="0"+clockMinutes;
}
var clockSeconds = myDate.getSeconds();
if (clockSeconds<10){
clockSeconds="0"+clockSeconds;
}

NEWTIM=currHour+":"+clockMinutes+":"+clockSeconds;

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 17th, 2020, 3:03 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
This video shows how to count up:

https://www.youtube.com/watch?v=hME0zs9 ... 130JRwfNQc

Change the ticker to minus and set the starting value at the number you want and that should work.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 17th, 2020, 10:36 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
I'm gonne try it.

Thanks Mac

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 21st, 2020, 10:01 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Hi Mac,
Script works fine. A few questions...
When the countdown reached 00:00 it displays 0-1:59
Is there a way to stop it automaticly and show 00:00 until you start it again?

My main question was if it is possible to get a Clock countdown, not a countdown clock :-) that reads the actual time.
Let say it is 10:05:00 on the normal clock. The Countdown then automatically sets itself to 55:00 and counts back to 00:00 as the normal clock is at the next hour. When the new hour starts the countdown starts again with 59:59

The whole action should be automated.
I need the clock for a radiostation where i work as a dj.

Kind Regards,
Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 21st, 2020, 10:53 am 
Offline

Joined: April 13th, 2010, 5:00 pm
Posts: 19
Opus: 9.75
OS: Windows 11
System: DELL
mins = 5
secs = 30
total = 0
active = 1
if (TIME =='')
{
while (active == 1)
{
TIME = String(mins + ":" + String.format("02.0",secs))
wait(1)
secs--
total++

if (secs < 0)
{
secs = 59
mins --
}

if (mins < 0)
{
active = 0
}
}
}


For this message AtakSport has been thanked by : Ad Mulders


Top
 Profile  
 
 Post subject: Re: Clock CountDown
PostPosted: March 21st, 2020, 2:16 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
This example will get the current time and count backwards.

You have to set the ticker speed accordingly and if you want it to reset at a different time other than midnight, set the myTicker = 0 to the right value.

</mack>


You do not have the required permissions to view the files attached to this post.

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : Ad Mulders


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 22nd, 2020, 9:50 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Hello Mac and AtakSport

I tried the script form Mac and it counts back form the current minutes and seconds at the moment you start.
I played with the script of AtakSport and modified it a bit so it works like i asked.
This is my modification:

mins = 60 - SYSTEM_TIME_MINUTE
secs = 60 - SYSTEM_TIME_SECOND
total = 0
active = 1
if (TIME =='')
{
while (active == 1)
{
TIME = String(mins + ":" + String.format("02.0",secs))
wait(1)
secs--
total++

if (secs < 0)
{
secs = 59
mins --
}

if (mins < 0)
{
active = 0
}
}
}


The script that is often use to display the clock is doing something stragen that i can't fix.
Runs fine but sets 1 hour up the current time... How can i fix it?

var myDate = new Date();
var currHour = myDate.getHours();
var clockMinutes = myDate.getMinutes();
if (clockMinutes<10){
clockMinutes="0"+clockMinutes;
}
var clockSeconds = myDate.getSeconds();
if (clockSeconds<10){
clockSeconds="0"+clockSeconds;
}

NEWTIM=currHour+":"+clockMinutes+":"+clockSeconds;

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 24th, 2020, 6:57 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Try:

Code:
var currHour = myDate.getHours() - 1;


</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : Ad Mulders


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 26th, 2020, 10:31 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
The clock counts down but when it starts he runs in sync but after a few minutes the contdown drops seconds.
How can i clear that problem?


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 26th, 2020, 1:52 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Can I first check is this HTML5 or Exe project?

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 27th, 2020, 7:00 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
It is an EXE project.

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: March 29th, 2020, 1:49 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I didn't realise there was a download.

Looking at that - you're running two loops - the ticker and the script while / wait. Personally, if I'm running things in sync, I would use one loop and calculate the clock and the countdown from that single point.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: April 5th, 2020, 6:09 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Hello Mac,
2 loops? I was not aware of that. How do I make them both run in 1 loop?

Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject: Re: Clock CountDown
PostPosted: April 6th, 2020, 8:57 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I'd be inclined to just use the ticker.

You should change your script - the one with the while / wait loop so that it runs just once - basically it'll show the time remaining only when you run the script not every second in that while wait loop.

Then put what is left of the script into a function - so that you can call it when you.

Then you simply call the function from the ticker - hey presto - the time remaining is updated every second in sync with the other ticker events.

I would also suggest thinking about:

1. just use the ticker to control function rather than other events (setting of time) - this should be moved to the function where when you get the current time - you then use this to workout the time remaining.

2. this is the bigger one - use the same function to change those dots around the outside of the clock face. Each one appears to have an event handler - the program is checking lots and lots of things when really all you need to know is when each second passes from the ticker and use this to update everything else.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group