David Garza Posted January 2, 2006 Share Posted January 2, 2006 [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 Link to comment Share on other sites More sharing options...
Fitch Posted January 6, 2006 Share Posted January 6, 2006 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. Link to comment Share on other sites More sharing options...
David Garza Posted January 6, 2006 Author Share Posted January 6, 2006 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 Link to comment Share on other sites More sharing options...
comment Posted January 6, 2006 Share Posted January 6, 2006 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... Link to comment Share on other sites More sharing options...
David Garza Posted January 7, 2006 Author Share Posted January 7, 2006 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 Link to comment Share on other sites More sharing options...
Recommended Posts