Jump to content

Recommended Posts

Posted

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

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...