HockeyFan Posted October 9, 2008 Share Posted October 9, 2008 (edited) Hi! I was wondering if someone could explain to me what the first blank msgbox is that I get when i run the following example script from the help file: ; Demonstrates StdoutRead() #include <Constants.au3> Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend MsgBox(0, "Debug", "Exiting...") Is there a way to prevent this first "Blank" msgbox from being displayed? Thanks! Edited October 9, 2008 by HockeyFan Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 9, 2008 Share Posted October 9, 2008 (edited) Hi! I was wondering if someone could explain to me what the first blank msgbox is that I get when i run the following example script from the help file: ; Demonstrates StdoutRead() #include <Constants.au3> Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend MsgBox(0, "Debug", "Exiting...") Is there a way to prevent this first "Blank" msgbox from being displayed? Thanks! Just don't show it if it's empty: If StringStripWS($line, 8) <> "" Then MsgBox(0, "STDOUT read:", $line) Edit: Actually, I like the answer from Hubertus72 better... Edited October 10, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
HockeyFan Posted October 10, 2008 Author Share Posted October 10, 2008 try this:#include <Constants.au3> Local $line = "", $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While Not @error $line &= StdoutRead($foo) WEnd MsgBox(0, "STDOUT read:", $line) $line = "" While Not @error $line &= StderrRead($foo) WEnd MsgBox(0, "STDERR read:", $line) MsgBox(0, "Debug", "Exiting...") Thanks Hubertus72. Not sure I completely comprehend the concept , still working it through , but it does what I need. Thanks again!! Link to comment Share on other sites More sharing options...
jfitzger Posted November 2, 2008 Share Posted November 2, 2008 When I ran this I got the directory listing for a directory of choice. I did not have foo.bar on my machine naturally. When I ran it with redirection or with a non command interpreter .exe I got NO output. I am not sure whyHi!I was wondering if someone could explain to me what the first blank msgbox is that I get when i run the following example script from the help file:; Demonstrates StdoutRead()#include <Constants.au3>Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)Local $lineWhile 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line)WendWhile 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line)WendMsgBox(0, "Debug", "Exiting...")Is there a way to prevent this first "Blank" msgbox from being displayed?Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now