8 Replies Latest reply on Feb 16, 2009 5:03 AM by Orlando

    Script is Paused [Continue] [Cancel] on in the layout bar

    miw

      Title

      Script is Paused [Continue] [Cancel] on in the layout bar

      Post

      I have a script that checks to see that I have a unique input for a field named Location:Location.  Here it is:

       

      If [IsEmpty (Location::Location)]

      Show Custom Dialog ["Input Error";"A valid location name must be input (not a duplicate)! Select 'OK' to resume editing this record, 'Revert' to revert back to prior status."]

      If[Get(LastMessageChoice) = 3]

      If[Get (RecordOpenState ) <> 1

      Revert Record/Request [No Dialog] 

        End If

      Go to Field [Location::Location] 

      Enter Browse Mode [Pause]

      End If

      If[Get(LastMessageChoice) = 2]

      Revert Record/Request [No Dialog] 

      Commit Records/Requests [No Dialog]

      End If

      End If 

       

      It works reasonably well except when I opt to "revert" (a button selection on my layout which reverts back to prior status via a Revert Record/Request command) out of the field input at which point my custom dialog box opens as noted in the script; if I chose the "revert" option [#2] in the dialog box everything works out fine; I am out of the edit mode and everything is back to the way it was.  However, if I choose "OK" in the dialog box, I go back to the Location::Location field as directed by the script to resume editing as desired - but, if I opt to "revert" again, everything goes back to the way it was (no new record created or edit made, which is a good thing) but I notice that the script keeps running in my layout screen (the prompt is "Script is Paused [Continue] [Cancel] on in the layout bar).  I do not want to have to constantly check the layout bar to see if the script is paused; how can I get revise my script to stop if I opt to "revert" the second time?

       

       

       

       

        • 1. Re: Script is Paused [Continue] [Cancel] on in the layout bar
          Orlando
            

          Hi MIW

           

          To Exit the active script when you press the "Revert" button on your layout you will need to change a setting on the button setup.

           

          In Layout Mode, double click on your button to open up the Button Setting dialog and then in the options area for your Perform Script there is an option "Current Script:" this defaults to 'Pause'. Change this to 'Halt'

           

          This controls the state of any active script that is running at the time the button is pressed and you have the options to Halt, Exit, Pause and Resume, and this action is carried out after the script specified in the button is carried out I believe.

           

          I hope this helps 

          • 2. Re: Script is Paused [Continue] [Cancel] on in the layout bar
            miw
               Orlando:  I am using Filemaker 10; when I double click on the button for the button setup, the only option setup I get under revert record/request is to perform the function without a dialog box.  I cannot seem to find the "Current Script:" this defaults to 'Pause'. Change this to 'Halt' area you describe.  Any insights?
            • 3. Re: Script is Paused [Continue] [Cancel] on in the layout bar
              Orlando
                

              OK I thought the button was running a second Script that reverted the record, not calling the Revert Record / Request step directly.

               

              Try setting up a second script that was simply, Revert and then if needed Go to Layout, then call that script from your Revert button on the layout and select the Halt option I mentioned above.

               

              Let me know if this helps or not.

              • 4. Re: Script is Paused [Continue] [Cancel] on in the layout bar
                miw
                  
                Orlando:  Making the second script worked out well.  thanks for the input.  Maybe you know the answer to this:  If I am scripting a dialog box and want to include the current field result in a dialog box, I have been making for each different layout of my tables a script dialog similar to "do you want" & Table:field. Rather than writing so many scripts for such a dialog box for each layout/table, is there any way to write one script and replace the script language for table:field name to reflect whatever is currently the field result in any open layout?
                • 5. Re: Script is Paused [Continue] [Cancel] on in the layout bar
                  Orlando
                    

                  Glad that worked out for you.

                   

                  With regards to your second question, it should be doable, but may depend on the version of FileMaker you are using, are you using FileMaker 10?

                  • 6. Re: Script is Paused [Continue] [Cancel] on in the layout bar
                    comment_1
                      

                    I am puzzled why are you pausing your script to begin with.

                     

                    Re your second question, try using a script parameter. 

                    • 7. Re: Script is Paused [Continue] [Cancel] on in the layout bar
                      miw
                         Orlando, yes, I am using Filemaker 10
                      • 8. Re: Script is Paused [Continue] [Cancel] on in the layout bar
                        Orlando
                          

                         

                        Hi MIW

                         

                        For your second question are you simply wanting to display the value of the field in the dialog message, or have the field in the dialog as an input field?

                         

                        If its the first option then the simplest solution is to create your dialog message, as comment mentioned, in the Script Parameter and then have a sub-script that is simply a Show Custom Dialog step using Get ( ScriptParameter ) as the dialog message.

                         

                        So your main script might look something like this:

                         

                         

                        #
                        ... 
                        Perform Script [ “sDialog”; Parameter: "Do you want " & Untitled::Field4 & "?" ] 
                        # Your subscript runs with a dialog 
                        If [ Get ( LastMessageChoice ) = 2 // Yes ] 
                        Go to Layout [ “Untitled” ] 
                        End If 
                        ...

                         

                        And your sub-script sDialog would simply be:

                         

                        Show Custom Dialog [ Title : "Message" ; Message: Get ( ScriptParameter ) ; Buttons : “No” , “Yes” ] 

                         

                         
                        So when the user hits "Yes" in the dialog teh sub-script ends and you check the Last Message Choice result in your original script and act accordingly.
                         
                        And now you can call sDialog script from any number of scripts as long as you pass your dialog message through a Script Parameter.
                         
                        I hope this does the trick.