Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ping loop in hta

Status
Not open for further replies.

ajtsystems

IS-IT--Management
Jan 15, 2009
80
GB
Hi,

I am new to HTA but have a ping script. Is there a way to get this code to be integrated into hta so that the ip address can be input and a button presses to fire the command?

Can I right the output to the actual hta line by line.

Set objShell = CreateObject("WScript.Shell")

Set objWshScriptExec = objShell.Exec("ping 192.168.1.1")

Set objStdOut = objWshScriptExec.StdOut

Do Until objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If Len(strLine) > 2 Then
WScript.Echo Now & " -- " & strLine
Else
Wscript.Echo strLine

Loop


to adjust the ping length of time instead of a loop i will just ad a timeout in the objshell.exec.

James
 
the WIn32_Ping class might be better? you dont have to fanny around with stdout and .exec
 
Hi thanks for this feedback. How would I then get a response back to my hta window? I guess I would use if, then, else?

james

 
based on the results of the ping test, with your if then else just update a property of one of your controls in your hta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top