Sign in to follow this  
Followers 0
Rick

stdoutread & upx

10 posts in this topic

I've scanned the help, the scripts, and this forum but cant figure it

All I want to do is monitor the output of upx.exe in a progresson, can anyone help?

Rick


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites



it has to be easy, but been trying to suss this all day, can anyone help?


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

it has to be easy, but been trying to suss this all day, can anyone help?

Do you want to capture the output from UPX ?

$foo = Run(@ComSpec &  ' /c "c:/program files/autoit3/aut2exe/upx.exe" test.exe --best --force -o test2.exe', @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

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...")

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I have a 7meg file (test.exe) to compress and want to monitor the %complete

tho all i seem to get is the final output saying completion, tis most frustrating.

oops forgot to add "using progresson"

Edited by Rick

Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I have a 7meg file (test.exe) to compress and want to monitor the %complete

tho all i seem to get is the final output saying completion, tis most frustrating.

oops forgot to add "using progresson"

Looks like that information cannot be captured, have seen the same thing with other programs where it doesn't show the progress info at the time its normally shown in the command window.

Why not just show the UPX screen which is showing its progress ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Why not just show the UPX screen which is showing its progress ?

Yeah, thats what i've resorted to, tho doesnt look as appealing visually.

tis a shame AutoIt cant capture it, would it be classed as a bug to look into?

thanks for taking a look tho Jdeb


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

Yeah, thats what i've resorted to, tho doesnt look as appealing visually.

tis a shame AutoIt cant capture it, would it be classed as a bug to look into?

thanks for taking a look tho Jdeb

This is a COM version you can try to see if its an autoit thing or a general issue. This will show a CMD window but just minimise that ...

$WshShell = ObjCreate( "WScript.Shell" )
$objExecObject = $WshShell.Exec('"c:/program files/autoit3/aut2exe/upx.exe" test.exe --best --force -o test2.exe')
While Not $objExecObject.StdOut.AtEndOfStream
    $strText = $objExecObject.StdOut.ReadLine()
    ConsoleWrite($strText & @LF)
WEnd

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

nope, that didnt work, as it only displays final output, and not %done

Edited by Rick

Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

anyone any other ideas?


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

anyone any other ideas?

Modify the source for UPX to call fflush(stdout) after each call to printf() or fprintf(stdout) or whatever other method it's using to write to stdout. Quite simply, the program never flushes it's output buffer and thus AutoIt can't read it. The buffer is finally flushed when the program closes. Even if the buffer if flushed before closing you won't be able to read the progress via StdoutRead() because that text is being written straight to the console's screen buffer.

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