12 Replies Latest reply on Sep 15, 2016 11:23 AM by philmodjunk

    Script Problems


      Welcome Filemaker Community.


      I have an issue with a script performing weird.


      I have a script that opens a new window then performs a search and go's to a label layout.


      When I run this script using the debugger, step by step or just letting it run using the debugger, it opens like it should. BUT when I don't use the debugger at all, and it is close, it opens a new window that is the same as the list window that's used to choose a client to create the label from.


      So to recap:

      If I use the debugger, it works perfectly.

      If I don't use the debugger to step through the script, it won't go to the label layout that it should.


      Any ideas?


      Thanks guys!



        • 1. Re: Script Problems

          Let me recap what you said:

          I have a script.

          It doesn't work.

          Can you guess why?


          The first idea is that you actually post the script.

          • 2. Re: Script Problems

            Here ya go...picofscript.png

            • 3. Re: Script Problems

              As mention above, the script WORKS when i use the debugger to step through each step of the script and such.


              It DOESN'T work correctly when I don't use the debugger.

              • 4. Re: Script Problems
                David Moyer


                I'd recommend moving the Go To Layout on the second line to the first line and uncommenting it.  There's no guarantee that the $tempClientID will work without being on the right layout.

                You can also throw another Show Dialog in there with $tempClientID to see how it looks outside of the data viewer.

                Edit:  I don't see where it's used anywhere in your script anyway - meh.

                • 5. Re: Script Problems
                  David Moyer

                  In the image of your script, New Window step, I see Top:Get(WindowTop) | 20.

                  pipe 20?  It's hard to read.  What does that do?

                  • 6. Re: Script Problems

                    sorry about the picture, it didn't upload to look very well.


                    It says Top Get(WindowTop) + 20.... It just get's the windowtop placement and adds 20 spaces to it?


                    Like I said before, it is very weird that the script works perfectly when I use the debugger to trace it's every step, but when I just click on the button to run it from within the app without the debugger open, it opens a new window, but never gos to the "Make Label..." layout...

                    • 7. Re: Script Problems

                      When you ran this in the debugger, did you by any chance disable script triggers?


                      The layout changes and new window steps can trip script triggers. You should normally see this happen in the debugger as the trigger's script will pop up in the debugger, but if you disabled the triggers, then they won't and the behavior of your scripts in the debugger no longer match what happens when you don't use the debugger.

                      1 of 1 people found this helpful
                      • 8. Re: Script Problems

                        Phil that looks like the problem. The original layout "List Layout" has a script trigger and when I remove it from running, the script for print label works like a charm. I guess I am going to have to find a work around.


                        Thanks for all your help over the years and Everyone else. The input is always valuable.

                        • 9. Re: Script Problems

                          A standard method that I use for controlling script trigger behavior from within scripts:


                          At the start of every script performed by a trigger, I put these steps:


                          If [$$TriggersOff ]

                            Exit Script []
                          End If


                          In every script were I don't want script triggered scripts to interfere, I put:


                          Set Variable [$$TriggersOff ; Value: True ]


                          And before the script exits, I make sure to put in:

                          Set Variable [$$TriggersOff ; Value: False ]


                          And I usually have a script handy that just sets the variable to False or "" so that when debugging scripts, I can run that script to be sure that I haven't accidentally left this variable set to True because I terminated a script in the debugger before this variable could be set back to False.

                          1 of 1 people found this helpful
                          • 10. Re: Script Problems

                            Thanks Phil.


                            Weird how a tiny two line sort trigger would cause a complete explosion of a scripted button...


                            Thank you again for your time and help.

                            • 11. Re: Script Problems
                              David Moyer

                              ... computers are usually so forgiving.

                              • 12. Re: Script Problems

                                Yes, they do exactly what we tell them to do instead of what we want them to do....