1 2 Previous Next 21 Replies Latest reply on Jun 29, 2017 9:26 AM by philmodjunk

    pause/resume script

    what?

      Is it possible to use a script step to resume a script after it has been paused indefinitely (waiting for user interaction)?   So far, I can only restart the script by pressing the resume script button.   I would like to pause the script, then wait for a user to click on a field, which will trip a script trigger to resume the script.  Right now I am thinking of a pretty gnarly work around that involves a loop containing a pause script step for x amount of seconds with a kickout when a given field contains a certain value (to be set by script trigger when the user clicks on a designated field).

       

      Thank you

       

      Dave

        • 1. Re: pause/resume script
          bigtom

          They should really change the name from Pause/Resume to just Pause. There is nothing about resuming aside from the resume after a specified duration.

           

          This is one for the Ideas section. I run into this and need to get creative with how it works. Usually involves breaking the script into two. Not always possible.

          • 2. Re: pause/resume script
            bigtom

            You do have to admit that it is hard to account any number of things that might need to happen for the script to resume. Might not be realistic. Maybe a wait for resume option that is similar to the wait for completion option in PSOS.

             

            What happens if the resume is never sent? Will the next script run while the paused one is waiting? How many of these pause and wait scripts can you stack up with nested pauses waiting on each other.

             

            It sounds simple at first look, but maybe not.

            • 3. Re: pause/resume script
              what?

              Thanks for the reply.  "Sounds simple but it's not ". Like most things in life!

              • 4. Re: pause/resume script
                philmodjunk

                It's often better to break the script into two parts, divided at the point where you want to pause.

                 

                Script one simply runs. Script two, assigned to button or trigger as needed then continues execution by simply performing script two.

                • 5. Re: pause/resume script
                  what?

                  Thank you for your response.  That is what I am presently doing. It works fine until I host the database and use it with direct client. Then it runs too slowly for my purposes. So I decided to psos. But the script uses a lot of global variables.  They all go away when the script exits.  Looks like I'll have to substitute field data for the global variables. Then it should work.

                  • 6. Re: pause/resume script
                    wimdecorte

                    global variables do not go away when a script is done, their scope is the lifetime of the file's session:

                    All Variables Should Be Global... Or Not. - Soliant Consulting

                     

                    If you intend for the PSoS session to return data back to the calling script, use the Exit Script[ <your result>] in the PSoS script and use get(scriptresult) in the calling script.

                     

                    If you have to return multiple pieces of data, construct it as an array or json object so that it can be parsed easily in the calling script.  There are numerous other techniques out there for passing back multiple results.

                    1 of 1 people found this helpful
                    • 7. Re: pause/resume script
                      wimdecorte

                      what? wrote:

                       

                      I would like to pause the script, then wait for a user to click on a field, which will trip a script trigger to resume the script.

                       

                      Can't see it mentioned in the earlier replies; when you set up a button, expand the 'options' triangle and choose 'resume current script'.

                      That will resume the paused script.

                      • 8. Re: pause/resume script
                        bigtom

                        wimdecorte wrote:

                         

                        what? wrote:

                         

                        I would like to pause the script, then wait for a user to click on a field, which will trip a script trigger to resume the script.

                         

                        Can't see it mentioned in the earlier replies; when you set up a button, expand the 'options' triangle and choose 'resume current script'.

                        That will resume the paused script.

                        Another development UI thing that makes sense, but not. Thanks again wimdecorte. I remember 12 has resume as an option pretty front and center for a button setup, never used it.

                        • 9. Re: pause/resume script
                          beverly

                          Caveats with PSoS: always check for compatibility of scripts before using them in a call this way. Pretty much anything that might need user interaction (resuming a pause!) is not going to work on Server. I might have some script steps branch based on

                          Get ( ApplicationVersion)

                          for example, can be used to test and then branch for hosted or not.

                           

                          Beverly

                          • 10. Re: pause/resume script
                            what?

                            The filemaker phone support told me that when a psos script ends the session also ends, so the global variables reset. Is this not correct?

                            • 11. Re: pause/resume script
                              wimdecorte

                              That is correct; but the way you described it was: "when the script ends, they all go away".  It is important to understand when exactly they die.  They don't die because of the script ending, they die because of the PSoS session ending (which is the same as closing the file).  Perhaps you already understood this but I wasn't sure.

                              • 12. Re: pause/resume script
                                what?

                                Thank you.

                                 

                                Am I correct that when you exit a psos script that it closes the session in the server, thereby clearing the global variables on the server context?

                                 

                                I think that I might try a pause resume script step in psos to resume in 0.5 seconds in a loop that checks to kick out (therefore resume the script) if a global field contains a certain value set by the user in his/her own context. If several users are doing psos at once, does the server distinguish between the various contexts and allow their psos to be mutually exclusive?

                                • 13. Re: pause/resume script
                                  user21802

                                  Yeah. Filemaker has so many bad names!

                                  • 14. Re: pause/resume script
                                    BruceRobertson

                                    Won't work. There is no connection. One session does not know and cannot know anything about the global fields or variables set by another session.

                                    1 2 Previous Next