The code below will do the following:
-Every second, ping google.
-if google does not respond in 4 seconds, then disable the local area connection, wait 3 seconds, then re-enable it. Then wait 15 seconds before checking again
-if google does respond in that time, then re-check in 1 second again
Note: I only tested this on Windows 7
While True
Sleep(1000)
If ping("www.google.com") == 0 Then
run('wmic path win32_networkadapter where NetConnectionID="Local Area Connection" call disable')
sleep(3000)
run('wmic path win32_networkadapter where NetConnectionID="Local Area Connection" call enable')
sleep(15000)
EndIf
WEnd