Jump to content
Sign in to follow this  
qwer85

StdoutRead problem...

Recommended Posts

Why my script doesn't work?

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

GUICreate("CMD Console", 400, 400)
GUISetState(@SW_SHOW)
$myedit=GUICtrlCreateEdit ("", 10, 10, 380, 380)

$var = Run("cmd", "c:", @SW_HIDE, 2)

While 1
    $line = StdoutRead($var)
    If @error Then ExitLoop     ; This line doesn't function. Why?
    GUICtrlSetData($myedit, $line & @CRLF)
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Sleep(100)
Wend

ProcessClose("cmd.exe")
Edited by qwer85

Share this post


Link to post
Share on other sites

Maybe...

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

GUICreate("CMD Console", 400, 400)
GUISetState(@SW_SHOW)
$myedit = GUICtrlCreateEdit ("", 10, 10, 380, 380)

$var = Run("cmd", "c:", @SW_HIDE, 2)

Sleep(500)
$line = StdoutRead($var)
If @error Then MsgBox(0,"","ERROR")    ; This line doesn't function. Why?
GUICtrlSetData($myedit, $line & @CRLF)
ProcessClose("cmd.exe")

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Edited by weaponx

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  

×
×
  • Create New...