Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Test for LIVE internet connection

Featured Replies

I'm writing a small script to take my users to a website. The "Open URL" script step is a cakewalk. But I'm looking for a way to test if the user has a "Live" connection before I send them to their destination. This way if the user happens to have dial up I can inform them that they need to go online before they can continue.

Any Ideas?

Thanks,

Mel

I had to mess around a bit to do this. You appear to be on Windows so I used vbscript:

1. Make a vbscript that pings a known IP address that is sure to be outside a local network. I use one of the OpenDNS addresses for this.

This script is copied from here:

http://www.connectingdata.com/downloads.htm

in the file: VBscripts_repository_v1_0.zip

It is found in Category: Hardware, Category 2: Monitoring.

Here is (adapted) the vbscript:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")

Set colPingedComputers = objWMIService.ExecQuery _

("Select * from Win32_PingStatus Where Address = '208.67.222.222'")

For Each objComputer in colPingedComputers

If objComputer.StatusCode = 0 Then

Wscript.Echo "Remote computer responded."

Else

Wscript.Echo "Remote computer did not respond."

End If

Next

Just paste that into a file and call it testnet.vbs

I hope this is OK with Wim Decorte!

2. Create a Filemaker script as below (I called it pingit):

Set Variable [ $$Path; Value:"filewin:" & Get ( DesktopPath ) & "testnet.vbs" ]

Send Event [ open document/application; File Name: “$$Path” ]

[ Bring application to foreground ]

The FM script is set to find the vbscript on the desktop. You can change this to where you place yours.

Running the script produces a pop-up window outside FM that reports on the availability. Better would be to get a return value into Filemaker. I might try that,

Norman

  • 1 month later...

Does anyone know a cross platform way to test for a live internet connection while running FMP9? I would like to kill a script if there is not a connection, but I have not found anything that works on both platforms

Thanks

Yes, load a common, almost always :) available webpage (google, fmforums, etc) in a webviewer. If the user doesn't need to see it make it 1 pixel tall.

Use GetLayoutObjectAttribute in a calc to pull the html source data. Create a script loop that will find PatternCount ( [theHTMLsource] ; "

Leland

Thank you! I will give this a try. It sounds like the perfect solution. It would be nice if there was a Filemaker error code on the web viewer that indicates no connection (it displays a message of "no internet connection") to make this a bit easier, but your solution sounds great!

Thanks again.....Greg

This solution works perfectly.

I created a blank html page on my website, created a layout with a webviewer that looked to that page.....

added a 3 second pause to allow time for the page to load...

then scraped the data from the web page and loaded to a local variable.....I then checked the contents of this variable.

If it is not empty, then there is an active internet connection.

Thanks for the help!

Actually, the way you phrased it may be wrong...

Test it. Run your test on a machine that has the ethernet cable unplugged, or aircard off, or whatever to guarantee no internet. Now run your test.

Reason I say this, with no internet connection the webviewer may still load an error page. If so, your variable may still not be empty.

Instead of a blank page, maybe have a success message that you can look for...

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.