Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 11:23 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Digital clock...Minute dgits have no zero
PostPosted: March 28th, 2008, 2:20 pm 
Offline

Joined: March 25th, 2008, 10:27 pm
Posts: 2
I posted once before on this but can't trace the post...

Do any of you know how I can show a time format with the leading zero on the 1-9 mins as it current shows 1:9 pm at the moment...and I want it to show 1:09 pm

Please can you attach an example if you have one.


Top
 Profile  
 
 Post subject:
PostPosted: March 28th, 2008, 5:14 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
Here's a simple clock display for you. I'm sure there's a better way, but it gets the job done.


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

_________________
Opus Pro XE 9.1 Win7 64-bit Core i3 8MB RAM


Top
 Profile Visit website  
 
 Post subject: Time is on our side
PostPosted: March 28th, 2008, 11:29 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
David,

check this out
viewtopic.php?t=2922&highlight=clock



Also, if you ever want to find your posts just do a Search with your user name in the Author field.

_________________
_good things come to those who wait(0)_


Top
 Profile  
 
 Post subject:
PostPosted: March 29th, 2008, 12:27 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
You need to format the variables - mins & secs:

String.format("02.0",mins)+':'+ String.format("02.0",secs)

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:
PostPosted: April 20th, 2008, 12:47 am 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
mackavi wrote:
You need to format the variables - mins & secs:

String.format("02.0",mins)+':'+ String.format("02.0",secs)

Mack


Hi Mack,
I was going through the site trying to find a solution to this very problem. I have a clock on a page running Hours Minutes and Seconds. I have a hidden button on the page that I added this command to.
On Show- run Script

In the script I put this...

String.format+':'+("02.0",TextMINUTE)+':'+ String.format("02.0",TextSECONDS)

It says the script is ok, but the clock still has single digits. What am I doing wrong?

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 20th, 2008, 2:16 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
String.format+':'+("02.0",TextMINUTE)+':'+ String.format("02.0",TextSECONDS)

should be this::

String.format("02.0",TextMINUTE)+':'+ String.format("02.0",TextSECONDS)

Paul


Top
 Profile  
 
 Post subject:
PostPosted: April 20th, 2008, 2:39 am 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
paul wrote:
String.format+':'+("02.0",TextMINUTE)+':'+ String.format("02.0",TextSECONDS)

should be this::

String.format("02.0",TextMINUTE)+':'+ String.format("02.0",TextSECONDS)

Paul

Thanks Paul, but it is still not working. It says the expression is ok, but I still get single digits... any ideas?

Am I doing the procedure correctly? I have a hidden button that on show runs a script. Within that script I have the above string format. Seems as though it should work, but it is not.

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 20th, 2008, 4:08 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Hi Denn,
have a look at the script in this pub.
What I gave you works (just changed variables in Mack's post), as long as you feed it with the correct info.

Paul


Top
 Profile  
 
 Post subject:
PostPosted: April 20th, 2008, 6:44 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
Didn't see your attachment until after I posted this.

I think I may have found the problem. I'm not using a clock as a timer, I'm using the system clock H:M:S

I'm attaching the page of my program that has the clock. It is these variables that I need to be two digits rather than the one digit that is issued by the system. This is something I have been wishing that DW would fix for a long time. WHO wants to see single digits on a clock?


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

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 20th, 2008, 8:23 pm 
Offline

Joined: April 11th, 2005, 2:31 pm
Posts: 122
Location: Edinburgh
Hi Denn,

I have attached one possible solution - I am sure there is a more elegant ways but it will give you something to work on.

What I did:

Created 3 new variables called mySeconds, myMinutes and myHours
Replaced your text boxes in the clock with text boxes containing these variables
When the page opens a loop is started and within this loop there is a script (see below) this loop monitors the system hours, minutes and seconds and when any of these is less than 10 it adds a "0" to the appropriate variable mySeconds, myMinutes, myHours.

Here's the script:

mySeconds = SYSTEM_TIME_SECOND
myMinutes = SYSTEM_TIME_MINUTE
myHours = SYSTEM_TIME_HOUR

if (mySeconds <10)
{
mySeconds = "0" + mySeconds
}

if (myMinutes <10)
{
myMinutes = "0" + myMinutes
}

if (myHours <10)
{
myHours = "0" + myHours
}

// end script


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

_________________
Windows 7 Ultimate (32 bit)
Opus Pro 6.4, Opus 7
Dual Core Athlon 64 4000+
4 gb Ram


Top
 Profile  
 
 Post subject:
PostPosted: April 20th, 2008, 9:08 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
David wrote:
Hi Denn,

I have attached one possible solution - I am sure there is a more elegant ways but it will give you something to work on.

What I did: ...

Thanks David,

I'm getting on this right now. I'll post back later and tell you if I'm smart enough to figure it out! :D

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 20th, 2008, 9:53 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Denn wrote:
This is something I have been wishing that DW would fix for a long time.[/color] WHO wants to see single digits on a clock?


This can be inconvenient at times, but leading zeros have no value in calculations and will be stripped in any programming language. That's why you have to reinsert them for display.
Pick up most calculators and try to enter 02 -- you can't do it.

Paul


Last edited by Paul on April 20th, 2008, 10:02 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Thank you David...
PostPosted: April 20th, 2008, 10:00 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
David,

Brilliant… Not only did it work, I was able to change it from a 24 hour clock to a 12 hour clock by looking at what you did and adjusting it. I know just enough about scripting to do just that. If I have a template to go by I can usually adjust it to fit my needs.

Thank you very much. This has made a big improvement on a project I’ve had going on for a long time.

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 20th, 2008, 10:06 pm 
Offline
User avatar

Joined: March 12th, 2005, 10:31 pm
Posts: 140
Location: U.S.A. - Deep South
Opus: ver 7.06 - Opus Pro - Build 15130
OS: Windows XP Build 2600 Service Pack 3
System: (2) 3.2 CPUs Intel - (2) gigs ram - 3.2 tb HD
paul wrote:
Denn wrote:
This is something I have been wishing that DW would fix for a long time.[/color] WHO wants to see single digits on a clock?


This can be inconvenient at times, but leading zeros have no value in calculations and will be stripped in any programming language. That's why you have to reinsert them for display.
Pick up any calculator and try to enter 02 -- you can't do it.

Paul

That makes sense. I had not thought about that. However, it would be an improvement if this was built into OpusPro. I've been using a single digit clock within a program of mine for a long time because I did not know how to fix the problem and probably never would have figured it out on my own. Thanks to people like You David and Mac, I have found solutions to this and other problems, but it would be nice for DW to have something in the program to solve this problem for other who might want a clock on a page and not have to live with it as a single digit clock.

_________________
PlanetDenn.com
Lots of Fun Freeware
Image


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 20th, 2008, 10:09 pm 
Offline

Joined: April 11th, 2005, 2:31 pm
Posts: 122
Location: Edinburgh
You're welcome.

The only thing I might change in the script would be:

if (mySeconds <10)
{
mySeconds = "0" + SYSTEM_TIME_SECOND
}

and similarly with minutes and hours.

_________________
Windows 7 Ultimate (32 bit)
Opus Pro 6.4, Opus 7
Dual Core Athlon 64 4000+
4 gb Ram


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 27 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