Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6602 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hello, All }:|

I have tried to make a little test app for FMP's realtime functioning. It's an Alarm Clock.

I have 4 fields called Hour(Number, Global), Min(Number, Global), Sec(Number, Global), and Count (Number, Global).

I then set each field to the Hour, Minutes and Seconds for which I want the Alarm to sound. Say: 01, 24, 45.

I then have the following script:

Set Field [ AlarmClock::Count; 0]

Loop

     Exit Loop If [Get ( CurrentTime )  ≥  GetAsTime ( AlarmClock::Hour & ":" & AlarmClock::Min & ":"  & AlarmClock::Min)]

End Loop

Loop

     Set Field [AlarmClock::Count; AlarmClock::Count + 1]

     Exit Loop If [ AlarmClock::Count = 10 ]

     Beep

End Loop

This script never succeeds, but just runs endlessly.

I'm obviously missing a basic principle of working with Time fields. Can someone tell me why this isn't working?

Thanks again :

All My Best,

Jeffrey

Edited by Guest
Posted

That's what I tried first. The only problem there as I see it, is that Time doesn't specifically refer to the current time, but to any amount of time. So when it failed, I figured that was why and switched to GetAsTime.

Posted

I didn't make my point clear enough. It should be

Time ( AlarmClock::Hour ; AlarmClock::Min ; AlarmClock::Sec)
 



instead of




GetAsTime ( AlarmClock::Hour & ":" & AlarmClock::Min & ":"  & AlarmClock::Min)]

Get( CurrentTime ) remains untouched.

-jens

Posted

The Time() function IS more appropriate here. Nevertheless, it should work with GetAsTime() as well, so that's not the reason why it failed.

Is it possible that it did NOT fail? Your original post mistakenly uses minutes instead of seconds.

This topic is 6602 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.