1 Reply Latest reply on Nov 6, 2012 2:34 PM by databuzz

    Error Trap

    JFWX5

      Hi All,

       

       

      I have the following script:

       

       

       

      Set Variable [$FilePath; Value: If ( Abs ( Get ( SystemPlatform ) ) = 1 ; "filemac:" ; "filewin:" ) & Get ( DesktopPath ) & child::Name & ".pdf" ]

       

       

      Insert File [Insert; Display content, Never compress; child::container; "$FilePath"]

       

       

       

      What would I do to add some error trapping to this script so if it did not perform properly I would be warned?

       

       

       

      Thanks,

       

       

      John


        • 1. Re: Error Trap
          databuzz

          Hi John,

           

          You could add something like the following after your Insert File step to check for any errors:

           

          Set Variable [ $LastError; Value:Get ( LastError ) ]

          If [ $LastError  ≠ 0 ]

               Beep

               Show Custom Dialog [ Title: "Insert File Error"; Message:  "There was an error inserting the file. Error Code: "  & $LastError; Default Button: “OK” ]

               Exit Script [  ]

          End If

           

          You can also add:

           

          Set Error Capture [ On ]

           

          before the Insert File step to suppress any dialogs that might appear if there was an error.

           

          Hopefully that should get your going.

           

          Andrew

           

          FileMaker 12/11/10/9/8 Certified Developer

          Databuzz

          - - - - - - - - - - - - - - - - -

          Phone: +61 2 9484 6565

          Mobile: +61 418 468 103

          Email: andrew@databuzz.com.au

          http://www.databuzz.com.au