2 Replies Latest reply on Dec 2, 2009 10:56 AM by mrvodka

    Script Exit when closing the current window

    BatchMaker

      Title

      Script Exit when closing the current window

      Post

      Hello,

      I am using FMP10 over a LAN network, all on Mac OS X.

       

      I wrote a script that opens a new window (small, like a pop-up) and prompts the user to choose from a small list of records (2-5) in list view. I pause the script to wait for the user entry. I have a button that is set to resume the script, where the next step is to copy the necessary fields (set variable to be used later). The pop-up window then closes and leaves the user on the first window, where they started.

       

      I like the pause script step because it forces the pop-up window to remain on top until the user chooses a record.

       

      Their are two situations that do not behave as desired.

      One is that if the user closes the pop-up window, the script is still paused (instead of exiting the script).

      And two is that if they simply press enter, the script uses the first record by default (not as important as the first problem).

       

      Is there a variable or script step that could help with one or both of these problems? 

        • 1. Re: Script Exit when closing the current window
          philmodjunk
            

          With FMP advanced, you can customize the menu so that closing the window triggers a script to close the window and do any other steps you need done. Include a halt script step in this script to halt the original paused script.

           

          Without FMP advanced, you can use the script step "Allow User Abort" to keep the user from canceling the script or closing the window by clicking the close button on the window. You can then place your own close or cancel button on it to script whatever actions are needed along with closing the window. When you add this button, specify that current scripts be halted in Button setup to halt the paused script.

           

          To keep anything from happening when the user continues the paused script, put it inside an infinite loop.

           

          Loop

            pause/resume

          End loop

           

          The above "halt script" methods are what get your user out of this loop.

          • 2. Re: Script Exit when closing the current window
            mrvodka
              

            The subject is different from your actual post. There are different answers. For your subject line, if you have FMP Advanced, then you can use Custom Menus to override the Close Window script.

             

            For your post, you can use a paused loop to make the window act like a Modal window.

             

            New Window

            Allow User Abort [ Off ]

            Loop

            Pause [ Indefinitely ]

            End Loop

             

             

            Now your button that you use now to close teh window, when you go to choose the script for the button the default option it to pause the current script. Change it to either Exit or Halt.

             

             

             

            *Edit - Didnt see Phil's reply.