Jump to content

Read text from a dos-like window generated from a C program?


Recommended Posts

Look at my Net Send GUI wrapper

http://www.autoitscript.com/forum/index.ph...st&p=343332

#include <Constants.au3>

$computers = ''
    
$foo = Run(@ComSpec & ' /c net view', @ScriptDir, @SW_HIDE, $STDOUT_CHILD)

While 1
    $computers &= StdoutRead($foo)
    If @error Then ExitLoop
WEnd

ConsoleWrite ($computers & @CRLF)

EDIT: added include file

Edited by Zedna
Link to comment
Share on other sites

I do but it doesn't print anything in the console

$text = ""
    
    $wnd = Run("C:\Users\Alter\Desktop\**.exe -parameters..", "", @SW_HIDE)

    While 1
        $text &= StdoutRead($wnd)
        If @error Then ExitLoop
    WEnd

ConsoleWrite ($text & @CRLF)

EDIT: Nvm I got it! You really helped me, thanks a million!

Edited by Aassdd
Link to comment
Share on other sites

I do but it doesn't print anything in the console

$text = ""
    
    $wnd = Run("C:\Users\Alter\Desktop\**.exe -parameters..", "", @SW_HIDE)

    While 1
        $text &= StdoutRead($wnd)
        If @error Then ExitLoop
    WEnd

ConsoleWrite ($text & @CRLF)
What version of AutoIt are you using? There were major changes to StdOutRead() in 3.2.12.1.
Link to comment
Share on other sites

I should have used $STDOUT_CHILD

#include <Constants.au3>

$text = ""
    
    $wnd = Run("C:\Users\Alter\Desktop\.., "", @SW_HIDE, $STDOUT_CHILD)

    While 1
        $text &= StdoutRead($wnd)
        If @error Then ExitLoop
    WEnd

ConsoleWrite ($text & @CRLF)
Edited by Aassdd
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...