Student_coder

Appending CMD to the GUI

10 posts in this topic

 

Quote

Which is the easiest way to append CMD to the GUI ?? Can anyone suggest me.

 

Share this post


Link to post
Share on other sites



Have the command in an input box and assign it to a variable and then take that value from input box and put it in the Run() statement.

Share this post


Link to post
Share on other sites

@pranaynanda If we do in that way then CMD will run in separate window na??

Quote

I want it in the GUI.

For example if we press one button then cmd should run below the button in the same GUI.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

What do you wish to achieve? If you do it my way, then you can have your commands run in cmd. You can get the output using StdoutRead or get it to display in any other GUI element you like.

Edit: And it won't run it in a separate window. You can do it like this:

$a=InputBox("Command","Enter the command") ;Enter command
$b=Run($a,"", @SW_MAXIMIZE, $STDERR_CHILD + $STDOUT_CHILD);run the command
ProcessWaitClose($b); pause until the process completes
$Message = StdoutRead($b, True) ; Read the output
MsgBox(0, "Output", $b) ;Print the output in a message box

 

Edited by pranaynanda

Share this post


Link to post
Share on other sites

@pranaynanda ok Pranay. I will try as you said.

Thanks.

Share this post


Link to post
Share on other sites

@pranaynanda - Sorry to disturb you again Pranay.

In the code you have given me will display the output in a msgbox na.......

I want the output too in the same GUI......

That's what am asking.......

Can you help me with this ??

Share this post


Link to post
Share on other sites

You wouldn't want $b as the output - Try slightly modified as below.  

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>


$a=InputBox("Command","Enter the command") ;Enter command
$b=Run($a,"", @SW_MAXIMIZE, $STDERR_CHILD + $STDOUT_CHILD);run the command
ProcessWaitClose($b); pause until the process completes
$Message = StdoutRead($b, True) ; Read the output
MsgBox(0, "Output", $message) ;Print the output in a message box

 

Quote

I want the output too in the same GUI.....

$message is a variable that you can use in your GUI  (unless I'm completely missing what you want)

 

 


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites

GuiCtrlSetData will assign Data to a GuiCtrl.

Share this post


Link to post
Share on other sites

ok thanks ... I got it :)

Share this post


Link to post
Share on other sites
7 hours ago, shornw said:

You wouldn't want $b as the output

Yeah, I missed that. My mistake.

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