Brewman said it the best: "Your last script will only tell you if your computer is connected to a network, it won't tell you if your network is connected to the internet." This was proven when my internet connection went out before I even got that warning and the script all to happily announced that I was connected.
Oh well... back to the drawing board. And this time I plan to test it during the night when I can reset my router whenever I need as a fair test of what happens during an outage.
For now, it may still be of some use to others. I will leave the script below in tact even once the other version is completed because you never know. One mans trash and all that...
This is in general help and support as well, but I thought that it wouldnt hurt to post it here too.
There are plenty of reasons to check for an active connection, and this is a pretty different way of getting it done.
While 1 $connect = _GetNetworkConnect() If $connect Then MsgBox(64, "YES!!!", $connect) Exit Else Sleep( 3000 ) EndIf WEnd Func _GetNetworkConnect() Local Const $NETWORK_ALIVE_LAN = 0x1 ;net card connection Local Const $NETWORK_ALIVE_WAN = 0x2 ;RAS (internet) connection Local Const $NETWORK_ALIVE_AOL = 0x4 ;AOL Local $aRet, $iResult $aRet = DllCall("sensapi.dll", "int", "IsNetworkAlive", "int*", 0) If BitAND($aRet, $NETWORK_ALIVE_LAN) Then $iResult &= "LAN connected" & @LF If BitAND($aRet, $NETWORK_ALIVE_WAN) Then $iResult &= "WAN connected" & @LF If BitAND($aRet, $NETWORK_ALIVE_AOL) Then $iResult &= "AOL connected" & @LF Return $iResult EndFunc
And of course, I will give credit where it is due. I may have modified this code to my needs, but most of it belongs to rasim, and the original solution can be found here.
I truly hope that someone finds some use for this.