Function Ping(strHost) Dim oPing, oRetStatus, bReturn Set oPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address='" & strHost & "'") For Each oRetStatus In oPing If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then bReturn = False ' WScript.Echo "Status code is " & oRetStatus.StatusCode Else bReturn = True ' Wscript.Echo "Bytes = " & vbTab & oRetStatus.BufferSize ' Wscript.Echo "Time (ms) = " & vbTab & oRetStatus.ResponseTime ' Wscript.Echo "TTL (s) = " & vbTab & oRetStatus.ResponseTimeToLive End If Set oRetStatus = Nothing Next Set oPing = Nothing Ping = bReturn End Function Set obj = CreateObject("WScript.Shell") do hostring = "google.com" If Ping(hostring) Then Else obj.Run("netsh wlan connect name=Eq>E.txt") If Ping(hostring) Then Else obj.Run("netsh wlan connect name=wireless@bs") If Ping(hostring) Then Else Wscript.Sleep 2000 obj.run("chrome") Wscript.sleep 2000 obj.run("chrome") wscript.sleep 2000 obj.SendKeys "http://10.166.250.5/termsAuth/index.htm?www.google.com/" obj.SendKeys "{ENTER}" WScript.sleep 3000 obj.SendKeys "{TAB}" obj.SendKeys " " obj.SendKeys "{TAB}" obj.SendKeys " " WScript.sleep 3000 obj.SendKeys "^a" obj.SendKeys "2012LiHX" obj.sendKeys "{TAB}" obj.SendKeys "^a" obj.SendKeys "xuan1624" obj.SendKeys "{ENTER}" WScript.sleep 2000 obj.SendKeys "%{F4}" WScript.Sleep 2000 obj.SendKeys "%{F4}" obj.sendkeys "{ESC}" End If End If End If WScript.sleep 6000000 loop