6 Replies Latest reply on Aug 18, 2010 8:59 AM by philmodjunk

    Pause/Resume Script to satisfy Rreally Custom Dialogue.

    d.justins

      Title

      Pause/Resume Script to satisfy Rreally Custom Dialogue.

      Post

      Because filemaker doesn't allow a custom dialogue box with a drop-down menu, i made a layout that looks like a pop-up box and would satisfy what i need.

      I wrote a script for this custom dialogue box that does some custom validation specific to its use. I plan on reusing this script (hopefully) over and over. However, i haven't been able to insert this in a script and pause the script to let the user input in the box, select "okay" (performing valdiation and closing the box), then continuing the script.

      I could have used the pause for a specifc time interval, however my users want things to happen on their terms (any time would be too long and too short overall). So, i was wondering if it is possible to pause the script, waiting for the input of the other script, then to resume it on the user's input instead of a timed interval.

      FM11

      Thanks.

        • 1. Re: Pause/Resume Script to satisfy Rreally Custom Dialogue.
          philmodjunk

          Here's a link to download the Known Bugs List database file: 

          http://www.4shared.com/file/8orL8apk/FMP_Bugs.html

          The new and edit buttons that edit the revision history as well as the Find button all pop up such custom "dialog" windows. Take a look at the scripts and you'll find steps that do what's needed, adapted to work for both Mac and Windows platforms.

          If you see parts of this that don't make sense, feel free to post back with questions.

          • 2. Re: Pause/Resume Script to satisfy Rreally Custom Dialogue.
            d.justins

            Thanks Phil. This is exactly what i'm looking for, however i'm not quite getting how it works.

            I'm really not understanding the "Get (ScriptParameter" Function. I read the Filemaker Reference and it is still confusing to me. Is there any way you could give me a better example of how this works, or even just explain what it does in this script.

            I have a feeling that if i grasp this, it will really give me some more scripting power.

            Is this a key part to the script? (is it necessary to halt the script in a later script? if not, then how do i?)


            Sorry, i'm still but a newb. Thanks.

            • 3. Re: Pause/Resume Script to satisfy Rreally Custom Dialogue.
              philmodjunk

              Script Parameters are extremely powerful though not strictly necessary for this technique. It's a way to send information to a script for its use at the moment the script is performed in order to control what happens when the script executes. Buttons, Script Triggers and the Perform Script step all have the ability to send a script parameter.

              In the case of the Open Search Palette script, the parameter True or False is sent to the script to tell the script whether to clear the global fields that otherwise will show the criteria used to perform the last search of the bug report table. Enter layout mode and double click a "Find" button in this file, then click the Specify... button in the Button Setup dialog that pops up. You'll see True in the parameter box at the bottom of this dialog. Do these same steps with a Modify Find button and you'll find False being sent to the script as a parameter.

              Thus both Find and Modify Find buttons perform the same script but a click of the Find button starts you off with a floating window where all the fields have been cleared and Modify Find leaves the previously entered criteria in place so that you can modify them. The script uses the function Get ( ScriptParameter ) in order to access this information.

              In similar fashion, the New and Edit buttons  on the Main layout pass either nothing (New) or the serial ID (Edit) of the clicked version history record to tell the script whether to create a new version history record or to find and display an existing history record for modification.

              For an even better example of making good use of script parameters that can be found in the same file, check out the Delete Portal Row script. This script highlights the clicked portal row, checks to see if it's the blank bottom "add record row" and displays a customized confirmation message that displays data from the clicked portal row's record.

              I managed to remove all layout and table references from this script, instead passing the needed information via a list of values in the Script Parameter. The resulting script can be imported error free into any filemaker file and can be implemented simply by placing a button in the portal row and using it to pass a simple expression that generates a two value list on to the script.

               

              • 4. Re: Pause/Resume Script to satisfy Rreally Custom Dialogue.
                d.justins

                Okay, now i get it! I just wasn't looking at the button's setup close enough. How wonderful that is,wow.

                So then, you use halt to kill the previous script? (well, all scripts)

                This defintely will solve my solution, but it would still be wonderful to have a script step to control live scripts, just so i can run (and control) multiple scripts.

                I just want to rap this up though for referencing. The key to this method is putting the pause in the loop indefintely, until someone selects a button on your current layout that halts all scripts. This allows people to input and select a button on the current layout but cannot move from that layout until the button is pushed.

                Very cool

                Thanks alot Phil.

                • 5. Re: Pause/Resume Script to satisfy Rreally Custom Dialogue.
                  philmodjunk

                  The paused loop forces the window to simulate a "modal" dialog. It keeps the window in the front and prevents the user from interacting with any other filemaker window until it is dismissed--at which time a script or button setup option uses "halt script" to interrupt the infinite loop. There's also a custom menu in place that replaces the close window action with a script that closes the window and then uses halt script to kill off the loop.

                  • 6. Re: Pause/Resume Script to satisfy Rreally Custom Dialogue.
                    philmodjunk

                    If that trick doesn't work for you, you may need to investigate some plug ins. I've heard of at least one that is supposed to give you an enhanced dialog box--so you may find one that will work better for you.