#include #include #include #Region ### START Koda GUI section ### Form= $MainGUI = GUICreate("Internet Test", 400, 200, -1, -1) $GroupBox1 = GUICtrlCreateLabel("Do you want to start testing your internet connection on your device?", 40, 50, 400, 20) GUICtrlCreateGroup("", -1, -1, 1, 1) $ButtonYes = GUICtrlCreateButton("&Yes", 230, 160, 75, 25) $ButtonCan = GUICtrlCreateButton("&Cancel", 310, 160, 75, 25) GUISetState(@SW_SHOW) $GUI2 = GUICreate("Which Region?", 400, 200, -1, -1) $ButtonEU = GUICtrlCreateButton("Europe", 20, 20, 80, 30) $ButtonNA = GUICtrlCreateButton("North America", 120, 20, 80, 30) $ButtonAU = GUICtrlCreateButton("Australia", 220, 20, 80, 30) $GUIConnecting = GUICreate("Connecting...",200,100,-1,-1) $LabelConn = GUICtrlCreateLabel("Connecting..." ,40, 50, 400, 20) GUISetState(@SW_HIDE, $GUI2) GUISetState(@SW_HIDE, $ButtonEU) GUISetState(@SW_HIDE, $ButtonNA) GUISetState(@SW_HIDE, $ButtonAU) GUISetState(@SW_HIDE, $GUIConnecting) #EndRegion ### END Koda GUI section ### $PingLimit = "150" Func PingFuncEU() Global $iPingEU = Ping("google.ie", 250) If $iPingEU Then ; If a value greater than 0 was returned then display the following message: MsgBox(0,"SpeedTest", "Your internet connection is: " & $iPingEU & "ms.") If $iPingEU > $PingLimit Then MsgBox(0, "Warning", "Your internet connection is unstable!") Else MsgBox(0,"","An error occurred. Error Code: " & @error) EndIf EndIf EndFunc Func PingFuncNA() ; Ping the AutoIt website with a timeout of 250ms. Global $iPingNA = Ping("192.0.43.10", 250) If $iPingNA Then ; If a value greater than 0 was returned then display the following message. MsgBox(0,"SpeedTest", "Your internet connection is: " & $iPingNA & "ms.") If $iPingNA > $PingLimit Then MsgBox(0, "Warning", "Your internet connection is unstable!") EndIf Else MsgBox(0,"","An error occurred. Error Code: " & @error) EndIf EndFunc Func PingFuncAU() ; Ping the AutoIt website with a timeout of 250ms. Global $iPingAU = Ping("192.0.43.10", 250) If $iPingAU Then ; If a value greater than 0 was returned then display the following message. MsgBox(0,"SpeedTest", "Your internet connection is: " & $iPingAU & "ms.") If $iPingAU > $PingLimit Then MsgBox(0, "Warning", "Your internet connection is unstable!") EndIf Else MsgBox(0,"","An error occurred. Error Code: " & @error) EndIf EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ButtonYes GUISetState(@SW_SHOW, $GUI2) GUISetState(@SW_SHOW, $ButtonEU) GUISetState(@SW_SHOW, $ButtonNA) GUISetState(@SW_SHOW, $ButtonAU) Case $ButtonEU GUISetState(@SW_SHOW, $GUIConnecting) GUISetState(@SW_SHOW, $LabelConn) Sleep(3000) GUISetState(@SW_HIDE, $GUIConnecting) GUISetState(@SW_HIDE, $LabelConn) PingFuncEU() Case $ButtonNA PingFuncNA() Case $ButtonAU PingFuncAU() Case $ButtonCan Exit EndSwitch WEnd