Buffo Posted October 22, 2006 Share Posted October 22, 2006 Hi, I scripted a GUI for a DOS-app which collects some parameters and starts the app. This app works for several minutes and has a screen output of the percentage that is done. I didn't manage to read this output. But I think it isnt's a standard output because on commandline the redirection with > file.txt won't work, too. Here a simple version of the script I use $var = Run(@Comspec & " /c ...", "" , @SW_HIDE, 2+4) $s_Msg = "" $s_Err = "" While 1 $s_Msg &= StdoutRead($var) If @error Then ExitLoop $s_Err &= StdoutRead($var) If @error Then ExitLoop Wend MsgBox(0, "Stdout:", $s_Msg) MsgBox(0, "Stderr:", $s_Err) The msgboxes will show the correct ouput but not until all is done Is is it possible to get the ouput in real-time? Thx in advance! Regards, Buffo Link to comment Share on other sites More sharing options...
GaryFrost Posted October 22, 2006 Share Posted October 22, 2006 if you use an IDE editor that has console output like SciTE then you can do the following with out having to hit ok on the msgbox every iteration of the loop #include <Constants.au3> $var = Run(@Comspec & " /c dir c:\*.*", "" , @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $s_Msg = "" $s_Err = "" While 1 $line = StdoutRead($var) If @error Then ExitLoop ConsoleWrite("StdoutRead: " & $line & @LF) $s_Msg &= $line WEnd While 1 $line = StderrRead($var) If @error Then ExitLoop ConsoleWrite("StderrRead: " & $line & @LF) $s_Err &= $line Wend MsgBox(0, "Stdout:", $s_Msg) MsgBox(0, "Stderr:", $s_Err) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Buffo Posted October 23, 2006 Author Share Posted October 23, 2006 Yes, I use Scite and I even tried to write to console but nothing happens I tried different "count" parameters in the StdOutRead And StdOutErr statements and I set "Peek" to true but nothing will work. Nearly half of the output will be the StdOutRead, the remaining half will be StdOurErr (but only after it's done...) Any ideas? Thx a lot. Regards, Buffo Link to comment Share on other sites More sharing options...
Lazycat Posted October 23, 2006 Share Posted October 23, 2006 Yes, I use Scite and I even tried to write to console but nothing happens I tried different "count" parameters in the StdOutRead And StdOutErr statements and I set "Peek" to true but nothing will work.Nearly half of the output will be the StdOutRead, the remaining half will be StdOurErr (but only after it's done...)Any ideas?You may try my workaround for this problem here: http://www.autoitscript.com/forum/index.php?showtopic=22224This is not perfect, but did the job. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Buffo Posted October 23, 2006 Author Share Posted October 23, 2006 (edited) Thx for your reply At once I tried out your workaround but it didn't work, too This test code I used: $app = _DConsoleRun(@Comspec & ' /c app.exe') While ProcessExists($app) ConsoleWrite(_DConsoleRead() & @LF) WEnd _DConsoleFree() But nothing is written in console. Any ideas? Regards, Buffo Edited October 23, 2006 by Buffo Link to comment Share on other sites More sharing options...
Lazycat Posted October 23, 2006 Share Posted October 23, 2006 Thx for your reply At once I tried out your workaround but it didn't work, too But nothing is written in console. Any ideas? Regards, BuffoTry to run script without redirecting output to Scite (just run from explorer), and don't use ConsoleWrite. Like this: $app = _DConsoleRun(@Comspec & ' /c app.exe') While ProcessExists($app) MsgBox (0, "title", _DConsoleRead()) WEnd _DConsoleFree() Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Buffo Posted October 23, 2006 Author Share Posted October 23, 2006 It's the same: only an empty MsgBox() Link to comment Share on other sites More sharing options...
GaryFrost Posted October 24, 2006 Share Posted October 24, 2006 The problem is the application is backspacing on the same line and updating the percent, not sure how to deal with that. Not too much console experience. No help here. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Buffo Posted October 24, 2006 Author Share Posted October 24, 2006 @gafrost: Thx for your efforts It's a pity you couldn't help Is there any one who has more experience and could help me? Please get in touch with me. Thx a lot! Regards, Buffo Link to comment Share on other sites More sharing options...
Lazycat Posted October 24, 2006 Share Posted October 24, 2006 The problem is the application is backspacing on the same line and updating the percent, not sure how to deal with that.This is exactly the problem, that UDF should solve... It tested and works for UPX, besweet, oggenc and couple another apps I tried. No thought why this not works for you, Buffo. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) 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