From AutoIt Wiki
Pings a host and returns the roundtrip-time. Adapted from AutoIt docs.
Syntax
$var = Ping(address/hostname [,timeout])
Parameters
| address/hostname | May take the form www.autoitscript.com or 178.50.76.4. |
| timeout | Time to wait for answer in milliseconds. Default is 4000.(Optional) |
Return Value
Success: Returns the roundtrip-time in milliseconds (greater than 0).
Failure: Returns 0 if host is not pingable or other network errors occurred and sets @error to:
| 1 = | Host is offline |
| 2 = | Host is unreachable |
| 3 = | Bad destination |
| 4 = | Other errors |
Example
$var = Ping("www.AutoItScript.com",250)
If $var Then; also possible: If @error = 0 Then ...
Msgbox(0,"Status","Online, roundtrip was:" & $var)
Else
Msgbox(0,"Status","An error occured with number: " & @error)
EndIf