1 2 Previous Next 17 Replies Latest reply on Jul 5, 2017 9:13 AM by BeatriceBeaubien

    Internet Connection Check


      Dear FM PPL,


      Is there a way to check whether there is an Internet Connection whether the file is on a win or mac?


      The solution I have must also have an internet connection to work. I wish to have a check in place first and if there is no connection that it provides a message followed by simple exit application.


      There is no FM server involved. So get(connectionstate)=0 is not applicable.


      I am not sure how to go about getting this check in place and wonder if anyone else has done this. Thank you in advance ppl and any idea is appreciated.




        • 1. Re: Internet Connection Check

          Create a global field, use the script step to Insert from URL something you expect to always be there such as http://www.google.com.  Then test if the size of the global field is greater than zero with the Length ( Field ) function.  If it is zero, then you don't have an internet connection (well, technically, you could have DNS problems, but this is would be a fairly accurate test). 

          1 of 1 people found this helpful
          • 2. Re: Internet Connection Check
            Stephen Huston

            Add a webviewer data object, or conditionally-hidden or -formatted text objects which display  appropriate messages based on whether or not the web-based object test (per Taylor) passes or fails.

            • 3. Re: Internet Connection Check

              Ok great advice and appreciate it.  Though still have possibly one problem.....perhaps.


              Set up a webviewer on the layout.  will hide later on.

              have global field g_website_google.

              Have script

              set webviewer [ object name: "WV5"; url:"http://www.goggle.com"] etc

              clear [Select; table:g_website_google ]   //this clears global field to balnk

              insert from [Select; No dialog; url g_website_google; http://www.google.com]

              if length (table:g_website_google ) =  0

              show custom dialog

              end if



              Now I am not sure of two things with this.  One I do not think this looks right.

              second when I do execute with an internet connection the field is populated.


              when I remove internet connection I get a filemaker popup saying no internet connection followed by my custom dialog.  Is this normal and should I just omit my custom dialog?






              • 4. Re: Internet Connection Check
                Mike Duncan

                Hi HJ,


                I think you can choose one method or the other, either web viewer OR insert from URL. You wouldn't really need both.


                If you use the web viewer method, you will want to pause to wait while the web viewer loads something. If you use the insert from URL step, the script pauses for a while until it times out if it doesn't get a response. You might have more control over the time before giving up using a web viewer... then check it's contents with a GetLayoutObjectAttribute function.


                Hope this helps.


                • 5. Re: Internet Connection Check

                  Remember for web view or Insert from URL to work, those objects have to exit on the layout.  You can hide them by moving them past the right margin.  But they must be somewhere on the layout or else you can't webview and you can't Insert. 

                  • 6. Re: Internet Connection Check
                    Stephen Huston

                    hjvanes wrote, in part:


                    when I remove internet connection I get a filemaker popup saying no internet connection followed by my custom dialog.  Is this normal and should I just omit my custom dialog?

                    Do you still get the built-in error message if you turn Error Capture to ON immediately before the insert step?


                    That's really what Error Capture is for, allowing you to trap for and respond to errors in your own way instead of the built-in defult responses.

                    1 of 1 people found this helpful
                    • 7. Re: Internet Connection Check

                      Gone down path of just insert from url.  Saves a bit of time as well.  Already have a registration check via use of webviewer afterwards...so I cannot place any more time on it.


                      Did the Error capture on as you said Stephen and solved the issue.  Had this placeed right at beginning of script.  Ensured that field is placed on layout but sized it as 1 width and 1 height placed right at the back and far right  so cannot be seen at all.


                      Thanks guys and appreciate your help.  Works like a charm now.



                      • 8. Re: Internet Connection Check
                        Stephen Huston

                        Glad to hear all that worked out.


                        It's interesting that Set Error Capture (ON) seems to be 100% only when placed immediately before a step where you need to trap the error. It seems logical that turning it ON at the start of a script would make it active fore the entire script, but that isn't always the case. Inserting it right where you want it to work is the trick. I even have a few scripts where I use that step more than once just to be sure all of the error possiblities I want to catch and handle myself are caught.

                        • 9. Re: Internet Connection Check

                          Yes you are right and I have noticed that as well in the past where I also needed to put it in more than just one place like you.


                          Thank you again.

                          • 10. Re: Internet Connection Check

                            Why do you say that Set Error Capture[On] won't work for a whole script? That's the expected behavior and I've never seen it fail.

                            • 11. Re: Internet Connection Check

                              I know that for specific error messages Set Error capture (On) will simply not work.  I found this link which I looked up sometime ago and gives a list of the types of errors.



                              • 12. Re: Internet Connection Check
                                Stephen Huston

                                I experienced Error Capture failure in hosted systems on in FP7 files, primarly when using v10 and v11 frequently enough that I got in the habit of turning Error Capture ON in the step immediately before any step where I intended to capture an error, even if it had been set on elsewhere earlier in the script. It's been a couple of years since I last had to rewrite a script that way, so I don't know if my cautionary practices avoided the problem or if later versions solved the problem.


                                It happened to me several times in FMP 10 and 11, and I simply adopted my practice to avoid the problem.


                                However, it sounds as though it was still a problem for hjvanes in this current thread, and the proximity of the Error Capture step reportedly made a difference in the last week, though I'm not sure the version of FMP has been stated in this thread.

                                • 13. Re: Internet Connection Check

                                  Yes it did occur for me as well......in both FMP12 and recently FMP13...same solution.


                                  The proximity did work and glad it did. 

                                  • 14. Re: Internet Connection Check

                                    I use this:

                                    IsEmpty(Get ( SystemIPAddress ))


                                    If it's empty you have no internet connection.  If it's not, you do.

                                    1 2 Previous Next