|
-
May 10th, 2009, 12:20 AM
#1
Thread Starter
Addicted Member
How to read the standard output during runtime?
Hello all,
I need your advice please:
I execute shell command that can take up to 5 minutes. This command command writes to standard output during its running.
I'm using this way:
Code:
With CreateObject("wscript.shell")
AllocConsole
ShowWindow GetConsoleWindow, SW_HIDE
commandExec = "cmd /c blahblah"
With .exec(commandExec)
line = .stdout.readall
end with
My question: How can I read the standard output during it's running? As you can see, I get the standard out AFTER the "cmd /c" execution is finished (5 minutes....). I'd like to see it and display it in REAL time.
I'd like to show it to users just as the output is updated (like UNIX "tail" command), so if you know a good way to implement this also, it will be very appreciated.
Thanks in advance!
-
May 10th, 2009, 01:48 AM
#2
Re: How to read the standard output during runtime?
vb Code:
With .StdOut If Not .AtEndOfStream Then DoEvents Text1.SelStart = Len(Text1.Text) Text1.SelText = .ReadAll() End If End With
or keep adding to str variable
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|