View Full Version : Total Clock Function Utility
mrdmx1024
03-20-2008, 09:30 PM
I am trying to create a "do all, say all" clock utility and have most things working. This is my first go at a AM7 project and would love a little help. The countdown and alarm functions seem to be kickin me in the tail....
I have tried severl different combo's here and I know I am just not putting stuff in the right area or missing something very obvious.
Any help would be great...
pjborg
03-21-2008, 12:33 AM
On your Alarm button, Button9, the Masked Input returns a table, not a string, and you'll need to make the other labels invisible before displaying the alarm time, so I changed it as follows:
tbl_result_alarm = Dialog.MaskedInput("Alarm", "Your alarm time:", "##:##:##", "12:00:00", MB_ICONQUESTION, " ");
if tbl_result_alarm ~= nil then
Label.SetText("lbl_Alarm", tbl_result_alarm.Displayed);
Label.SetVisible("lbl_Time", false);
Label.SetVisible("lbl_Timer", false);
Label.SetVisible("lbl_Date", false);
Label.SetVisible("lbl_Duration", false);
Label.SetVisible("lbl_Alarm", true);
end
Hope that helps a bit. pj
mrdmx1024
03-21-2008, 06:33 AM
pjborg,
Thanks for that code! I used it for the Timer button as well and now all the buttons are working proper.
Now I just need to work on hte functionality of the Set Alarm and Timer...
Thanks again, that worked great...
mrdmx1024
03-21-2008, 09:33 AM
Do I need to make all these on dif. pages if I want them all to work at the same time? Since I am calling start timer with each option from the page do I need to have a page for each?
holtgrewe
03-21-2008, 10:47 AM
Here's a post from a few month's ago by longedge
very nice example of an alarm with digital and analog clock.
http://www.indigorose.com/forums/showpost.php?p=111481&postcount=19
hth
mrdmx1024
03-21-2008, 07:08 PM
Well I got the alarm working on page 2. Its in 24 hour time now, any suggestions on getting it into 12 hour and using the AM/PM would be great.
I still havent got the countdown timer working yet. But I still think I might have to put each clock function on a new page because when I, say, select the time it starts the clock on that page so the stopwatch it running already when you hit it...
Would also love to be able to load my own sound as the alarm...
I will keep pluggin away at this and uploading my latest...
mrdmx1024
03-21-2008, 07:47 PM
Well yet another... I cant quit! Okay this is my last post tonight...
I almost have the file load for the alarm sound but I am missing something.
Thanks to all!
rexzooly
03-21-2008, 08:46 PM
Well yet another... I cant quit! Okay this is my last post tonight...
I almost have the file load for the alarm sound but I am missing something.
Thanks to all!
still missing alot be seems to be a good idea :)
:yes
mrdmx1024
03-22-2008, 01:17 AM
I know there is still a lot to do... its my very first project and I am having a great time with it... Got any input for me?
longedge
03-22-2008, 04:29 AM
Well yet another... I cant quit!
...and it only gets worse - Indigo Rose (in the guise of AMS) has been the only thing to come between me and my wife in 40 years :D
rexzooly
03-22-2008, 04:47 AM
ya simply keep to it you seem to have a nice project get some Open source images to make it look sexy :) and there you go i think you will have it in th bag :) always look around the site at example that you might be able to intogreat into your project :)
any ya AMS dose that :) once you start you might as well get married to the software lol :)
rex
mrdmx1024
03-22-2008, 01:21 PM
Well I threw together a quick interface artwork and here is what I have up till now.
Countdown or Timer code still missing.
I have the alarm working but no file load and no AM/PM.
Probably would be good to put a little more code with the data input box for errors and such but its working for now..
Seems that when it changes pages the timer stops on that page.... I put everything on seperate pages hoping that they would all run on different timers but they dont seem to be doing that at all... Stumped on that one for sure!!! Would be great to be able to start a stopwatch then go back to the Time page or some other function, then back to check on the stopwatch...
longedge
03-22-2008, 02:02 PM
I put everything on seperate pages
Just on this one point - I moved away from using separate pages routinely quite a long time ago.
Most of the page objects can be re-used by loading content dynamically and when I can't do that I hide and show objects as appropriate.
Having said that, we all find what's best for our own purposes, that's just my preference. It suits me because my projects tend to be 'content based' usually videos which lend themselves particularly well to my method.
mrdmx1024
03-22-2008, 03:44 PM
Well I had it all on one page... I was hiding what needed to be hid and all that but I found that when I would run another clock function it would stop the other. So I thought the pages would run seperate of each other but that doesnt work either....
longedge
03-22-2008, 04:02 PM
Sorry I was wandering off topic :)
I was talking in general terms and not specifically about your project.
I think that for most of us, certainly for me, it's true to say that it takes some time to appreciate the fact that objects can be re-used and that you can sometimes reduce a project from dozens of pages to just two or three by doing it.
rexzooly
03-23-2008, 03:33 AM
i use these days 2 pages maybe 3 depending on the project and i have one main page that as everything on i have on for all the background images and styles has i have a habbit deleting or moving them and another one if needed added settings things like that so everything for me runs little but better for me.
mrdmx1024
03-25-2008, 01:07 AM
This is my 3rd version of a timer...
Still not working. I have purchased the Timer Plug-ins from Worm and I love them. However with this one I am putting the entire code into the start button and just starting one of the timers... Can somebody please give a helping hand with this one. this is my 5th clock function and the only one I have left to finish this project up and move on to a new one...
tbl_result_timer = Dialog.MaskedInput("Timer", "Countdown from:", "##:##:##", "00:10:00", MB_ICONQUESTION, " ");
if tbl_result_timer ~= nil then
Label.SetText("lbl_Timer", tbl_result_timer.Displayed);
Label.SetVisible("lbl_Timer", true);
end
_tt = Label.GetText("lbl_Timer");
--math string to seconds
_tt_sec = String.ToNumber(String.Mid(_tt, 1, 2))*3600+String.ToNumber(String.Mid(_tt, 3, 2))*60+String.ToNumber(String.Mid(_tt, 5, 2));
--get systemtime
_at_sec =System.GetTime(TIME_FMT_SEC);
_at_min = System.GetTime(TIME_FMT_MIN);
_at_hr = System.GetTime(TIME_FMT_HOUR);
--math systemtime into seconds
_at_comp = _at_hr*3600+_at_min*60+_at_sec;
--math new end time
_nt=_at_comp+_tt_sec;
_t_set=_nt-_at_comp;
--write start time to input2
Input.SetText("Input1",_at_hr..":".._at_min..":".._at_sec);
if _t_set > 0 then
--get systemtime
_at_sec =System.GetTime(TIME_FMT_SEC);
_at_min = System.GetTime(TIME_FMT_MIN);
_at_hr = System.GetTime(TIME_FMT_HOUR);
--math system time into seconds
_at_comp = _at_hr*3600+_at_min*60+_at_sec;
--time remaining in seconds
_t_set=_nt-_at_comp;
--split into hours, minutes and second
_nt_set_hr=Math.Floor(_t_set/3600);
_nt_set_min=Math.Floor(Math.Mod(_t_set,3600)/60);
_nt_set_sec=Math.Mod(_t_set,60);
--refresh input box
Label.SetText("lbl_Timer",_nt_set_hr..":".._nt_set_min..":".._nt_set_sec);
if _t_set > 0 then
Timer.StartTimer(4, 1000, "Timer_Callback_4");
end
end
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.