Function ConvertPing(HostName)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
DIM fso, f, ts
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("ping.txt")
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
Do While ts.AtEndOfStream <> TRUE
retstring = ts.ReadLine
P = InStr(retstring, "Pinging")
If P > 0 Then
P1 = InStr(retstring," [")
If P1 > 0 Then
HostName = Mid(retstring,9,P1-9)
End If
End If
If InStr(retstring, "Reply")> 0 Then
ConvertPing = TRUE
Exit Do
End If
Loop
ts.Close
End Function