Jump to content

StdoutRead problem...


qwer85
 Share

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