9 Replies Latest reply on Feb 21, 2017 8:43 AM by mdiehr

    How to resume a paused script?


      OK...so I have a script that runs on a button click. After a few things, I want to show a new window (not a Show Custom Dialog, because one of the fields must be a drop-down list). I have that working. But I want the script to pause indefinitely until the user enters data into the fields on the new window ( a modal dialog by the way). Then continue on once they click either OK or Cancel on the modal new window. Basically I want the new window to behave exactly like a Show Custom Dialog box with User inputs. The only difference being one of the fields on the new window is a drop-down list showing a Value List.



      Here's what I have


      Stuff leading up to showing the new window...

      New Window [Style: Dialog; Name: "Pop-out Window"; Top:200; Left: 300]

      Go to Layout ["Pop-out Window" (Verification Master Records)]

      Pause/Resume Script [Indefinitely] ///does this need to be here?


      Next I want a second script to run when the user selects "OK" button on the "Pop-out Window" layout. The second script is called "Pop-out OK button"


      On the button bar setup dialog, there is a setting for Pause Current Script. How does that play into this? Would I be better off not using a button bar, and just standard single buttons instead?


      Then I have a third script in the event that the user selects the Cancel button called "Pop-out Cancel button"


      I have read about a mysterious Resume Script step. I have FM14 Advanced, and haven't found it. Do you have to re-use Pause/Resume Script? Does Pause/Resume Script work to turn the script back on once paused?


      Message was edited by: Dave Evans

        • 1. Re: How to resume a paused script?

          Just create a script named "Resume".

          (It doesn't have to be named Resume. You could name it anything. You could name it "World Peace")


          The script should have no script steps.

          The key is that the button which calls this script has the "resume current script" option selected.

          • 2. Re: How to resume a paused script?

            The mysterious Resume script step does exist, but is only available in layout mode, when you associate a single step to a button.


            It goes like this.

            You have a script which contains all you gotta do:


            1 ---

            2 ---

            3 ---

            Pause/Resume Script (indefinitely)

            4 ---

            5 ---

            6 ---


            You run it. Ideally on line 3 you move to a layout where there's a OK button.

            That button simply does "Resume script", which will make the script from above continue with line 4.


            (The "Cancel" button does an Exit Script or a Halt Script)

            • 3. Re: How to resume a paused script?

              Drop the Pause/Resume and don't worry about Resume.


              Make sure your New Window has the Modal Advanced...style and remove the ability to close it.


              Then attached your script #2 to a text box that says "Submit" and your script #3 to one that says "Cancel".

              • 4. Re: How to resume a paused script?

                In my experience resuming a script can be problematic—what happens if a user somehow navigates to the window in question without having got there by script, so there is no curet script to resume?


                Another approach is to break your script in two. Script 1 is all the steps up to the opening of the modal window, at which point the script is completed. You set the window up so that the only way to close it is via a button which runs a script. This will be script 2, all the stuff you want to do after the user has entered data there. Using this approach, you might also consider adding a Cancel button, so the user can close the modal window without doing anything at all—in case that got there, say, simply out of idle curiosity.


                I think this is more or less the approach suggested already by David Jondreau.

                • 5. Re: How to resume a paused script?

                  I did get it working. Once I realized the flow, and where the drop-down for button action is and how it is used. I got it working exactly how I want. I am going to try to prevent the layout from appearing any other way besides the triggering script by removing it from the list of layouts. This fortunately is a database that very few of our people ever use, and they can be taught how to use it properly. I included basic error capturing to prevent most unexpected behavior.


                  But, thanks to you all for the helpful comments. I don't know what I would do without the help I get on these Community boards.



                  • 6. Re: How to resume a paused script?

                    BTW, how can I copy/paste script steps onto this board? Does filemaker allow that? Or do I just need to take screen shots of the Script Workspace?

                    • 7. Re: How to resume a paused script?

                      the MBS plugin will let you do it easily.

                      • 8. Re: How to resume a paused script?

                        Alternatively, print the script to a pdf and copy it from there. Quick and easy.

                        • 9. Re: How to resume a paused script?

                          When you associate a Script with a Button, the are hidden button options which you need.


                          You have to expose the additional Options by clicking the triangle.  Then you will see the choice of "Halt current script, Exit current Script, Pause current script and Resume current script"

                          2 of 2 people found this helpful