am632 Posted March 23, 2011 Posted March 23, 2011 Hi, I guess ill start with my code snippet... This Runs a batch file which works fine $startscan = RunWait("startscan.bat") I want to display the cmd output into an edit box I have comeup with this but it is obviously completely wrong as it doesnt work $getcommandinfo = StdOutRead($startscan) $editbox = GUICtrlCreateEdit("", 24, 56, 377, 185) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetData($editbox, $getcommandinfo) The script runs fine, the batch file runs and finishes successfully but the edit box is just blank, I want the edit box to display what it in the cmd box and I want to hide the cmd box? thanks - i hope u get what i mean
Andreik Posted March 23, 2011 Posted March 23, 2011 Check this example to get the idea: $MAIN = GUICreate("Example") $EDIT = GUICtrlCreateEdit("",5,5,390,365,BitOR(0x00200000,0x0800)) $INPUT = GUICtrlCreateInput("systeminfo",5,375,330,20) $RUN = GUICtrlCreateButton("RUN",340,375,55,20) GUISetState(@SW_SHOW,$MAIN) While True Switch GUIGetMsg() Case $RUN $CMD = GUICtrlRead($INPUT) If $CMD <> "" Then $PID = Run(@ComSpec & " /C " & $CMD, "",@SW_HIDE,0x2) ProcessWaitClose($PID) GUICtrlSetData($EDIT,StdoutRead($PID)) EndIf Case -3 Exit EndSwitch Sleep(10) WEnd
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