Jump to content
Sign in to follow this  
Alek

StdoutRead and StdinWrite

Recommended Posts

Alek

how can i get StdoutRead and StdinWrite to also show the text in the programs consol im reading/writeing too?


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites
Valuater

heres a start

#include <GUIConstants.au3>
#include <Constants.au3>

Global $cmdinfo

GUICreate("dosprompt", 334, 424, -1, -1)

$cmd = GUICtrlCreateInput("", 40, 10, 200, 20)
$textorso1 = GUICtrlCreateLabel("CMD:", 10, 10, 25, 20)
$Close = GUICtrlCreateButton("Close!", 10, 384, 80, 20)
$Clear = GUICtrlCreateButton("Clear", 100, 384, 80, 20)
$Closex = GUICtrlCreateButton("sendcommand!", 245, 10, 80, 20)
GUICtrlSetState( -1, $GUI_DEFBUTTON)
$Outputbox = GUICtrlCreateEdit("[incomminginput]", 10, 55, 314, 300, $ES_READONLY + $ES_MULTILINE + $WS_HSCROLL + $WS_VSCROLL + $ES_AUTOVSCROLL)
GUICtrlSetBkColor( -1, "")
GUICtrlSetColor( -1, 0xfffafa)
GUISetState(@SW_SHOW)

recall_command("dir c:\")

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $Close
            ExitLoop
        Case $msg = $Clear
            GUICtrlSetData($Outputbox, "[incomminginput]")
        Case $msg = $Closex
            $inputz = GUICtrlRead($cmd)
            recall_command($inputz);
    EndSelect
WEnd

Func recall_command($info)
    $cmdinfo = Run(@ComSpec & " /c " & $info,  @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD)
    While 1
        $line = StdoutRead($cmdinfo)
        If @error Then Return
        GUICtrlSetData($Outputbox, GUICtrlRead($Outputbox) & @CRLF & $line);
    WEnd
EndFunc   ;==>recall_command

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Alek

heres a start

code...

8)

so i have to make my own consol?? :P

[font="Impact"]Never fear, I is here.[/font]

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  

×