3 Replies Latest reply on May 29, 2015 8:44 AM by davisoly

    Cancel print



      Cancel print




      I have a print button which launches a script that takes the user to a print friendly layout, prints it then return to the original layout.  My issue is when the user clicks cancel on the print prompt.  This then prompts a second window asking if the user wants to continue the script of cancel.  If the user cancels they're left on the print friendly layout and the script is halted.  If the user continues the script the record status changes to printed and nothing comes out.


      How do I have the script bypass the message asking if the script should continue or not and handle the users selection on my own with a Get(LastMessageChoice)?  Is that even possible with the print promtps?

        • 1. Re: Cancel print

          Just before the Print step, add this script step:

          Set Error Capture [on]

          This will prevent the built in error message dialog from interrupting your script.

          You can detect when "cancel" was clicked in this type of dialog box if you use:

          Get ( LastError )

          in an if Step immediately after the Print step

          Set Error Capture [on]
          If [ Get ( LastError ) = 0 ]
           Put the rest of your script for what should happen if they don't click cancel here
            Put the script steps that should take place if cancel is clicked here
          End If

          • 2. Re: Cancel print

            Crap, my mistake, I places the set error capture AFTER the print step which is why it never blocked the message.  As always, thanks Phil!

            • 3. Re: Cancel print

              The freeze problem still persists in FM Go 14 under the following condition: First the print dialog will appear. Tapping Print will produce an overlapping dialog allowing the user to select a printer before actually printing. The original dialog is loses its focus and is slightly faded into the background. At this point, the user may select the printer (no problems), dismiss the dialog by tapping outside its borders (no problems), or tap the Cancel button on the original faded background dialog - kind of bypassing the select printer dialog that is in focus. This causes the freeze and required restart of the iPad.

              If the printer selection dialog had a "Back" or "Cancel" command option of its own, the problem could be eliminated. Now it is a situation requiring user-training, teaching them not to click the out of focus "cancel" button before the top dialog is dismissed. Is there a way to script the user around this problem in the meantime?