7 Replies Latest reply on Jun 2, 2017 8:26 AM by planteg

    Strange behaviour


      Hi All


      I have a script that searches a file for outstanding picking tickets, and then selects the right printer and pints them - see attached.


      If I run this normally from a button it might miss some outstanding tickets, and prints about 3 pages per ticket.  If I run it using the Script Debugger and the Data Viewer to see what is doing what, it all works perfectly...


      Any ideas how to make it always behave?


      Thanks a lot

        • 1. Re: Strange behaviour

          Does the script always miss the same ticket(s)?

          • 2. Re: Strange behaviour

            Hi Dude


            No, it prints a ticket in the queue, sometimes more than one from the queue, but always with 2 blank sheets per ticket.


            I realised I forgot the actual print script so here it is



            • 3. Re: Strange behaviour

              Also here's the scripts that actually generate the picking tickets and adds them into the queue for printing

              • 4. Re: Strange behaviour

                Hi Peter,


                when running the script with the Debugger do you run step by step ? If so that could mean a timing problem (I haven't look at your scripts). One way to debug that kind of issue is to use the successive approximation method:


                1. Run step by step for the 1st half of the script.
                2. If the issue happens, you know it's in the 1st half.
                3. If the issue did not occur, the run the scritp up to the half, and then run step by step.


                This way you know in which half does the issue occur, and you can further converge to the offending step.

                1 of 1 people found this helpful
                • 5. Re: Strange behaviour

                  Divide and conquer. Excellent suggestion!

                  • 6. Re: Strange behaviour

                    Hi Planteg


                    If I run the scripts to create the picking tickets in the Degugger it all works perfectly even when I run the print script in real time.  I suspect a timing issue of the script to create the Picking Header (PickHead)  Any ideas how to overcome timing errors?


                    Thanks a lot

                    • 7. Re: Strange behaviour



                      the Debugger may be running a script a little bit slower. Was the script open in the Script Workspace at the same time ? That make running slower even further, you see the Workspace 'flashing'.


                      Another way to find where the delay would be needed is to put a pause for 1 sec at the end of a 'part' like right after a find. Don't insert many pauses, just move the one added if that doesn't solve the issue. Once you get to a location where issue disappear, you may move back the pause a few script step further to see if you can get closer to the step that needs a pause.