Vicks Posted September 30, 2006 Share Posted September 30, 2006 Hi.... I know this has been done and asked before but how do you get the input of command prompt and output it to an Edit box in a GUI for example I am trying to create my own command prompt with more options and what not #include <GUIConstants.au3> #include <Process.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("AForm1", 299, 170, 193, 115) $Edit1 = GUICtrlCreateEdit("", 0, 0, 297, 137 , $ES_READONLY) GUICtrlSetData(-1, "Msg * hi") $Button1 = GUICtrlCreateButton("Run It", 0, 144, 75, 25, 0) GUICtrlSetOnEvent($Button1, "Read") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Read() _RunDos(GUICtrlRead($Edit1)) GUICtrlSetData($Edit1 , "Msg * hi" &@CRLF& "what ever the message is in the command prompt would go here ..... but Msg * hi doesn't have a message in cmd") EndFunc Func Close() Exit EndFunc lol sorry for the bad example [s]Autoit[/s] Link to comment Share on other sites More sharing options...
GaryFrost Posted September 30, 2006 Share Posted September 30, 2006 #include <GUIConstants.au3> #include <Constants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("AForm1", 299, 170, 193, 115) $Edit1 = GUICtrlCreateEdit("", 0, 0, 297, 137, BitOR($ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL)) GUICtrlSetData(-1, "Dir") $Button1 = GUICtrlCreateButton("Run It", 0, 144, 75, 25, 0) GUICtrlSetOnEvent($Button1, "Read") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Read() $foo = Run(@ComSpec & " /c " & GUICtrlRead($Edit1), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & @CRLF) While 1 $line = StdoutRead($foo) If @error Then ExitLoop GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & $line) WEnd While 1 $line = StderrRead($foo) If @error Then ExitLoop GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & $line) WEnd EndFunc ;==>Read Func Close() Exit EndFunc ;==>Close SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Vicks Posted September 30, 2006 Author Share Posted September 30, 2006 #include <GUIConstants.au3> #include <Constants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("AForm1", 299, 170, 193, 115) $Edit1 = GUICtrlCreateEdit("", 0, 0, 297, 137, BitOR($ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL)) GUICtrlSetData(-1, "Dir") $Button1 = GUICtrlCreateButton("Run It", 0, 144, 75, 25, 0) GUICtrlSetOnEvent($Button1, "Read") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Read() $foo = Run(@ComSpec & " /c " & GUICtrlRead($Edit1), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & @CRLF) While 1 $line = StdoutRead($foo) If @error Then ExitLoop GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & $line) WEnd While 1 $line = StderrRead($foo) If @error Then ExitLoop GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & $line) WEnd EndFunc ;==>Read Func Close() Exit EndFunc ;==>Close thanks [s]Autoit[/s] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now