Can you display and update real time within a button?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Kwhiz
Junior Coder
Posts: 35
Joined: Wed Jan 12, 2005 6:19 pm

Can you display and update real time within a button?

Post by Kwhiz » Tue Feb 21, 2006 6:35 pm

I want to display (and update) the real time within a button in a modal dialog. Is this possible? I tried the following script, but it didn't work. It displays the real time initially, but the time doesn't update.


gettime>time

dialog>timerdialog
left=300
top=300
width=300
height=300
button=time,20,20,90,25,3
enddialog>timerdialog

label>mainloop
show>timerdialog,result
if>result=3,end
gettime>time
resetdialogaction>timerdialog
goto>mainloop

label>end


Thanks for your help,
Kwhiz

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Feb 21, 2006 8:35 pm

I don't think you want to do this with a modal dialog. Here is an example with a non-modal dialog. Click the button to close.


GetTime>ttime

Dialog>MyDialog
Caption= Time
Width=100
Height=80
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=0
Resize=0
Button=ttime,27,16,75,25,2
EndDialog>MyDialog

Show>MyDialog

Label>start
GetDialogAction>MyDialog,r
If>r=2,End
GetTime>ttime
Let>MyDialog.MSBUTTON0=%ttime%
ResetDialogAction>MyDialog
Wait>0.01
Goto>start

Label>End


Hope this is helpful,
Dick

Kwhiz
Junior Coder
Posts: 35
Joined: Wed Jan 12, 2005 6:19 pm

Post by Kwhiz » Wed Feb 22, 2006 12:49 pm

Thanks for your reply, but if possible I would like to put the real time into a MODAL dialog. I already have a large modal dialog set up which stays open throughout the day and constantly waits for input. I would like to insert the current time into the modal dialog, give or take a minute (it doesn't have to be the exact time).

Your non-modal dialog was interesting, but not really helpful in my situation. Sorry and thank you.

The original question remains. Does anyone know how to keep the current time updated within a modal dialog? Any ideas would be very helpful and much appreciated. Thank you!

KWhiz

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Feb 22, 2006 1:19 pm

It would be impossible to update the time on a modal dialog, because ... well, because the dialog is modal! Modal means NOTHING happens until the user dismisses it. Everything gets held up until the dialog is dismissed. So how could it be updated with the current time if it is modal? It can't. Impossible.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Kwhiz
Junior Coder
Posts: 35
Joined: Wed Jan 12, 2005 6:19 pm

Post by Kwhiz » Wed Feb 22, 2006 4:08 pm

.
Oh yes, thank you for responding, I think I understand better now. For those of you who understand the old BASIC computer programming language (my only computer programming experience, and that was from 20 years ago), I was confusing the word "modal" to be the equivalent of the BASIC command, "input."

In other words, I was thinking that non-modal dialogs didn't have input (ie, buttons, etc). But of course non-modal dialogs have input! Sorry for the confusion, but I think I understand better now. I've spent a little time today reading and studying the Help files to obtain better clarity on the subject, and I believe I undertand it now. So off I go now to create a new non-modal dialog!

Thanks alot for everyone's help,
Kwhiz

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts