5 Replies Latest reply on Jun 5, 2010 5:05 PM by ralvy

    Script step(s) to cause a button click?



      Script step(s) to cause a button click?


      Is there a way for a script step, or series of script steps, to cause a button to execute? I need the button to run its associated script, instead of just using a PerformScript step. I need this because I need the script to cause a Resume of a Paused script, and there's no script step to do this.


      What's happening here is that the script performs certain actions in a modal window. If certain conditions are met, I want the script to close the modal window, otherwise I want the modal widow to remain active.

        • 1. Re: Script step(s) to cause a button click?


          I think you pretty much need to have another button, in the "modal" window, with the option "Halt" exiisting script. Because your "modal" window is a Loop, Pause [ indefinitely], End Loop, right?


          As you say, there is no script step to explicitly "Resume" running script. 


          One thing that is interesting is that the Pause/resume script step changes to "Resume" automatically if you are using a Custom Menu, and want to reassign a FileMaker command (like block Print when you're in a Print script, paused on a layout to Preview before printing). I guess "Resume" is the only thing that makes sense in a Custom Menu. But that doesn't help you, as the problem is that you're inside a Loop, and no buttons work.


          • 2. Re: Script step(s) to cause a button click?

            Although indeed there is no way to make the button itself fire, there may be some kind of trickery done that runs Install On Timer to run a script and then Halt your child script. However, I am not sure how you area planning on envoking the script while in the modal window. Script Trigger? Could you further elaborate on this?

            • 3. Re: Script step(s) to cause a button click?

              Well, here's what I finally ended up doing. The problem I was working around is that the modal window is in List View. I have a Delete button that appears in each record row. I wanted that button to close the modal window if the last record is deleted from that List View, otherwise errant tapping of the white recordless screen real estate with the mouse causes the infamous Filemaker warning message that you need to create a new record, etc. But the Delete script is supposed to not close the modal window if this isn't the last record being deleted. So I need the script to close the modal window when the last record is deleted, and resume the calling script; otherwise leave the window alone. But scripts can't do this. I was relying on the user not tapping on the recordless display (or at least not getting confused with the warning message that tapping causes), and immediately click on the Close Window button, which closes the windows and resumes the calling script.


              So this is what I ended up doing this afternoon. I created a duplicate layout that has no body, and appears in Form View. I have the Delete script navigate to that layout if the FoundCount is 0. It has the same Close Window button as the original List View layout. To the user, there's no difference in the two layouts, other than one having no records displayed. Now when they errantly tap on the layout with no records, they don't get that silly message.

              • 4. Re: Script step(s) to cause a button click?

                You could set your Delete button to resume current script, and make the Delete script:


                Delete Record

                If [ Get (FoundCount) ]

                Pause Script [ Indefinitely ]

                End If

                • 5. Re: Script step(s) to cause a button click?

                  Ah ha! That works. I don't need the extra layout now. Thanks.