Jump to content
Salesforce and other SMB Solutions are coming soon. ×

canceling a loop with a button


chris_sfo

Recommended Posts

I'm building an auto launch feature with a user specifiable pause before another script is called (opening other dbs basically). I switch the user to another layout with a running countdown, and I've included a "cancel" button that calls a halt and switches the user back to the primary layout. I included the button because the status area is hidden, and the user would be stuck on the interstitial layout if they cmd-period/esc out of the script. However, while the loop is running, the button isn't clickable. Is this a known limitation? Any thoughts?

 

Thanks!

chris

Link to comment
Share on other sites

That would seem to make sense to me (the button not working).

Is there any logical place you could place a "pause/resume script" step. You can set the amount of time based on a calculation.

Link to comment
Share on other sites

[ QUOTE ]

Is there any logical place you could place a "pause/resume script" step.

 

[/ QUOTE ]

 

I could have just used the built-in pause as suggested, however that would kill my nifty countdown timer. frown.gif Perhaps this is the best route though... Thanks

Link to comment
Share on other sites

[ QUOTE ]

Set your button to exit/halt current script (in button definition).

 

[/ QUOTE ]

 

Tried this, still doesn't work. At least on Mac, it seems like the only way to exit a loop like this is cmd-period.

 

Thanks for the input though! -chris

Link to comment
Share on other sites

Here's the countdown routine I'm using...fyi.

 

Code:


Allow User Abort [ On ]

Set Field [ time_start, Status(CurrentTime) ]

Set Field [ time_end, Status(CurrentTime) + time_pause ]

Loop

Refresh Window

Set Field [ time_countdown, time_calc & " secs" ]

Exit Loop If [ Status(CurrentTime) ≥ time_end ]

End Loop


Link to comment
Share on other sites

The button cannot work, because the screen is so busy refreshing, it cannot register the button being pressed. At least that's what's happenning on my Mac.

 

Try:

 

...

Loop

Pause/Resume Script [ "0:00:00" ]

Refresh Window

Set Field [ time_countdown, time_calc & " secs" ]

Exit Loop If [ Status(CurrentTime) ≥ time_end ]

...

Link to comment
Share on other sites

[ QUOTE ]

Try:

Pause/Resume Script [ "0:00:00" ]

 

[/ QUOTE ]

 

Interesting idea...and it *does* work somewhat. However the cursor definitely does not know which way is up. wink.gif It's constantly flashing between the cmd-period and standard cursor. Plus clicking still isn't successful 100% of the time. However you've given me some other ideas to try. Thanks for thinking outside of the box! -chris

Link to comment
Share on other sites

Ok...my first idea based on your suggestion was way too complicated. As it turns out, a slight variation including a pause of 1sec works like a charm. Below is the script that works perfectly. Thanks for helping me sort this out.

 

Code:


Set Field [ time_start, Status(CurrentTime) ]

Set Field [ time_end, Status(CurrentTime) + time_pause ]

Loop

Set Field [ time_countdown, time_calc & " secs" ]

Refresh Window

Pause/Resume Script [ “0:00:01” ]

Exit Loop If [ Status(CurrentTime) ≥ time_end ]

End Loop


 

Man I love Filemaker... wink.gif

chris

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use