Jump to content

Read console applicattion output


Lazycat
 Share

Recommended Posts

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

Link to comment
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.

Link to comment
Share on other sites

  • 2 years later...

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()
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...