Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Read & write StdOut line by line (real-time)

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3243
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Read & write StdOut line by line (real-time)
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Read & write StdOut line by line (real-time) - 6/5/2005 8:11:33 PM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
I'm trying to create the effect of real-time command output echo...

<%
Response.Buffer = False
%>

<html>
<head>
<title>ASP StdOut R/W Test</title>
<body>

<%
strComputer = Request.QueryString("host")

Set WshShell = Server.CreateObject("WScript.Shell")
Set WshShellExec = WshShell.Exec("tracert " & strComputer)

strResults = WshShellExec.StdOut.ReadAll
strArray = Split(strResults, Chr(13) & Chr(10))

For Each x In strArray
Response.Write (x & "<br>")
Next
%>

</body>
</html>

My for loop here is superfluous as it isn't engaged until all StdOut has already been buffered. In a web context, this results in the page not loading at all until the WshShell.Exec completes (several seconds or more for a trace route)...the goal being to consecutively Response.Write each line after the page loads.

I'm just curious if there's a way to read & write each line of StdOut as it "occurs"...like for each StdOut.ReadLine in WshShellExec do Response.Write(StdOut.ReadLine). :)

Thanks...GLM
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Read & write StdOut line by line (real-time) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts