WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Network Related

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Average Ping Time in Milliseconds UDF

 Keywords: Ping Time Millieseconds  iPing ipPing wxPing udfGetAvgPingTime

#DefineFunction udfGetAvgPingTime(url)
	objShell = ObjectCreate("WScript.Shell")
	cmd = 'ping ':url
	objWshScriptExec = objShell.Exec(cmd)
	objStdOut = objWshScriptExec.StdOut
	Data = objStdOut.ReadAll
	startpos = Strindex( Data, 'Average', 1, @Fwdscan)+9
	endpos =   Strindex( Data, 'ms', startpos, @Fwdscan)
	avgtime =  StrSub( Data, startpos, endpos - startpos )
	objStdOut = 0
	objWshScriptExec = 0
	objShell = 0	
	Return avgtime
#EndFunction


ret = udfGetAvgPingTime('www.yahoo.com')
Pause('Average Ping Time in Milliseconds', ret) 

Exit

Article ID:   W18374
Filename:   Average Ping Time in Milliseconds UDF.txt
File Created: 2010:08:18:09:29:22
Last Updated: 2010:08:18:09:29:22