Jump to content

stdoutread & upx


Recommended Posts

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!!

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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!!

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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