Sign in to follow this  
Followers 0
Lazycat

Read console applicattion output

4 posts in this topic

Long time ago I bring question about reading console. Problem was, that Autoit I/O functions are not work in some cases and retreive only "last" info, not intermediate. This problem was not solved at that time.

Now I again faced with this, spend a bit more time and found solution. Nothing new here, many pieces of code was at forum, so I can call this compilation.

Example shows how to constantly retreive compression percentage and progress data from UPX compressor and update GUI with this data (UPX not included, this exists in the "Aut2exe" subfolder in the Autoit installation folder, just copy upx.exe to example's directory).

Only problem I have with this - how to avoid visual appearing of empty console? Now I hide it's window, but console anyway appears for moment. Any thoughs about this?

DConsole.zip

Share this post


Link to post
Share on other sites



I did not have this problem, when i wrote my Wood's Installation GUI, the external compression tool which i used out puted like this:

where {chr8} represents the backspace character

Complete:       0%{chr 8}{chr 8}{chr 8}40%{chr 8}{chr 8}{chr 8}90%{chr 8}{chr 8}{chr 8}100%

was not a problem, i just read as normal and ignored the backspace characters.

Share this post


Link to post
Share on other sites

Hi,

Do you have an update for your script?

I don't know if it's an interference with scite but the console output is always grabbed by scite, I never get any output in the msgbox, even if I compile a script I still get no output.. It's rather odd. :P

#include "DConsole.au3"

Local $foo = _DConsoleRun(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE)
Local $line

While ProcessExists($foo)
    $line = _DConsoleRead()
    MsgBox(0, "STDOUT read:", $line)
Wend       
_DConsoleFree()
    
        
    
Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, 2 + 4)
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


Exit

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

Share this post


Link to post
Share on other sites

yes, i agree... it will only put tuff out in scite.

any idaes?

Damian666


and proud of it!!!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0