9 Replies Latest reply on Dec 1, 2011 2:02 PM by melastudio

    Open URL: how to intercept error

    melastudio

      Hello everybody...

       

      I'm using the open url to call the opening of another (free) app

      On the Mac/PC I get the error 5 (but it a custom layout for FMGo so this will never happen)

      But in FMGo a window appears telling me that is impossible to resolve the URL....

       

      How can I prevent this error and inform the user to download the App?

        • 1. Re: Open URL: how to intercept error
          pthomas

          Hi,

           

          Have you tried turning the error capture on and then testing to see if an error is returned when you try to open the url?

           

          Set Error Capture [On]

          Open URL [www....]

          If [Get ( LastError ) > 0]

            Show Custom Dialogue ["Warning"; "Please install the app!"]

          End If

           

          Cheers,

           

          Paul.

          • 2. Re: Open URL: how to intercept error
            melastudio

            I've done exaclty the same. I Also used a global variable to show the error but no error is displayed

            ...

            • 3. Re: Open URL: how to intercept error
              pthomas

              Hmmm not sure if this will work or not, but I would try putting a web viewer on your layout and populate it with the URL you are trying to open.

               

              Then see what the web viewer shows on the iPad/iPhone, hopefully some sort of error message is displayed in which case you should be able to use the GetLayOutObjectAttribute script step to look for that error message text and then display a warning to the user if it is found?

               

              If the error text is not found in your web viewer then procede with the Open URL command.

               

              Cheers,

               

              Paul.

              • 4. Re: Open URL: how to intercept error
                jbante

                As Paul said, using "Set Error Capture [On]" should supress FileMaker's error dialog (but I haven't tested this myself). If you're using "Open URL" to launch another iOS app, then, if sucessful, the script should halt immediately after the Open URL step, since FileMaker Go scripts don't support multi-tasking. You should be able to safely assume that, if the script continues executing at all after the "Open URL" step, it didn't work:

                 

                Set Error Capture [On]

                Open URL [appscheme:...]

                # Assume that anything executed after this point is because of an error

                Show Custom Dialog ["The operation could not be completed. Please install <app name here>."]

                1 of 1 people found this helpful
                • 5. Re: Open URL: how to intercept error
                  melastudio

                  The open url in iOS opens a Windows to show the web page or, such as in this case, the error.

                  So it appears that the open url returns no error but the error is returned in the web page that has opened...

                   

                  So using a web viewer and passing it's result should be a good idea: i'll do a try

                  • 6. Re: Open URL: how to intercept error
                    melastudio

                    Unfortunately WV doesn't understand that URL....

                    • 7. Re: Open URL: how to intercept error
                      melastudio

                      jbante ha scritto:

                      then, if sucessful, the script should halt immediately after the Open URL step, since FileMaker Go scripts don't support multi-tasking. You should be able to safely assume that, if the script continues executing at all after the "Open URL" step, it didn't work:

                       

                      Well. You're almost right...

                      But the window with the "web error" (that I attach) opens and the user has to close it; after closing it appears my dialog wth the error and, with another "open url", I'll send the user directly in the AppStore....

                       

                      Acceptable...

                      • 8. Re: Open URL: how to intercept error
                        pthomas

                        Thats a shame!

                         

                        Does the content of the WV change at all if the app is or isn't installed on the device?

                        • 9. Re: Open URL: how to intercept error
                          melastudio

                          WV blank...