January 2, 200620 yr [color:blue]Hello, This is my first post, so plese excuse if something is wrong. I've found it useful to timeout a loop if it is taking too long. Set Field [ Settings::gTime; Get (CurrentTime ) ] Loop Exit Loop If [GetAsTime ( Get ( CurrentTime) ) - GetAsTime ( Settings::gTime ) > 3 Exit Loop If [ ... ] ... Do what ever here ... End Loop I assume you can have multiple exits of a loop as long as one is met. Which is what I have. I have set it to exit after 3 seconds. Thanks and God Bless! David Garza
January 6, 200620 yr Nice idea. Note that in FileMaker 8 you can use a variable rather than a global field. Another option for an "escape hatch" is to use the Get ( ActiveModifierKeys ) function.
January 6, 200620 yr Author Hey, thank you for your suggestions! I will keep the ActiveModifierKey in mind for secrete such as logging into another user for permissions. Here is a revised copy of the script: Set Variable [$starttime; Get ( CurrentTime )] Loop Exit Loop If [GetAsTime ( Get ( CurrentTime) - $starttime ) > GetAsTime ( 00:00:03 ) Perform Script Here.... End Loop I changed the time to timeout format because it makes it better if you want to use hours, because before it would default to only seconds. Not you can use hours, such as: 13:27:32 It will timeout in 13 hours, 27 minutes and 32 seconds. Please let me know if there is a better way! Thanks and God Bless! David
January 6, 200620 yr GetAsTime() is meant to convert TEXT type data into TIME type. GetAsTime (time) does nothing. The correct syntax for your exit condition would be: Exit Loop If [ Get ( CurrentTime) - $starttime > Time ( 0 ; 0 ; 3 ) ] Using a timestamp might be more suitable here - just in case someone starts the script shortly before midnight...
January 7, 200620 yr Author Here you are: Set Variable [$starttime; Get ( CurrentTimeStamp )] Loop Exit Loop If [ Get ( CurrentTimeStamp) - $starttime > Time ( 0 ; 0 ; 3 ) ] Perform Script Here.... End Loop Thanks for all of your help and God Bless! David Garza
Create an account or sign in to comment