sysyphusjones Posted April 10, 2009 Share Posted April 10, 2009 I have been trying to capture stdout from the ms uptime CLI utility:MS uptime.exeuptime.exe is in the same directory as my script fragment. At a cmd window, I can redirect its output to a file so I think this ought to work.Here it is:#include <Constants.au3> $result = Run(@ComSpec & " uptime.exe ", @ScriptDir, @SW_HIDE , $STDERR_CHILD + $STDOUT_CHILD) ;MsgBox(0, "result", $result) ; !!! HERE !!! $line = StdoutRead($result) MsgBox(0, "UPTIME", $line)For some reason my resulting dialog is empty?Also I added a debug dialog (marked as !!! HERE !!! in the script) to establish that I was getting a process ID, which I am, but for some reason with this line added, my UPTIME dialog now contains a windows copyright message??Thanks with any help Link to comment Share on other sites More sharing options...
martin Posted April 10, 2009 Share Posted April 10, 2009 I have been trying to capture stdout from the ms uptime CLI utility:MS uptime.exe uptime.exe is in the same directory as my script fragment. At a cmd window, I can redirect its output to a file so I think this ought to work. Here it is: #include <Constants.au3> $result = Run(@ComSpec & " uptime.exe ", @ScriptDir, @SW_HIDE , $STDERR_CHILD + $STDOUT_CHILD) ;MsgBox(0, "result", $result) ; !!! HERE !!! $line = StdoutRead($result) MsgBox(0, "UPTIME", $line) For some reason my resulting dialog is empty? Also I added a debug dialog (marked as !!! HERE !!! in the script) to establish that I was getting a process ID, which I am, but for some reason with this line added, my UPTIME dialog now contains a windows copyright message?? Thanks with any helpJust follow the example in the help for StdOutRead. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
BigDod Posted April 10, 2009 Share Posted April 10, 2009 #include <Constants.au3> Local $foo = Run(@ComSpec & " /c uptime.exe ", @ScriptDir, @SW_HIDE , $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
sysyphusjones Posted April 10, 2009 Author Share Posted April 10, 2009 Thanks BigDot 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