Jump to content
Sign in to follow this  
MiserableLife

having problems with console ...

Recommended Posts

MiserableLife

Hello everyone,

I've been trying to learn how to read console app with StdoutRead,

but i don't know why i cannot get what it gives while the app is running....

I've been testing my code with 7z(console),but i still couldn't find out what's wrong...

here's my code:

#include <Constants.au3>

$app = Run(@ComSpec & " /c " & '7z b', @ScriptDir, @SW_HIDE,$STDIO_INHERIT_PARENT)
While ProcessExists($app)
    sleep(100)
WEnd

without cmd:

#include <Constants.au3>

$app = Run("7z b ", @ScriptDir,@SW_HIDE,$STDOUT_CHILD)
While 1
    ConsoleWrite(StdoutRead($app))
    If @error Then Exit
WEnd
Edited by MiserableLife

Share this post


Link to post
Share on other sites
enaiman

tut-tut-tut ...

#include <Constants.au3>

$app = Run(@ComSpec & " /c " & 'ping 127.0.0.1', @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $output = StdoutRead($app)
    If @error Then 
        ConsoleWrite($output)
        ExitLoop
    Else
        ConsoleWrite($output)
    EndIf
WEnd

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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  

×