Jump to content
Student_coder

CMD issue

Recommended Posts

Student_coder

I am planning to embed cmd to my GUI. This is the function am using.

Func _getDOSOutput($command)
Local $text = '', $Pid = Run(@ComSpec & ' /c ' & $command, '', @SW_HIDE, 2 + 4)
While 1

  $text &= StdoutRead($Pid)

  If @error Then ExitLoop
WEnd
GUICtrlSetData($Output,$text)
EndFunc;==>_getDOSOutput

To the variable "$command" am passing the commands. The problem is that if we ping to a particular ip address it's not pinging. But if we just type ping it's replying.

Can anyone points me in the right direction ??

Share this post


Link to post
Share on other sites
Student_coder

No one is there.

Share this post


Link to post
Share on other sites
Student_coder

I have 3 tabs in a GUI. I tried to embed command prompt in one of the tabs but I was not able to do it. Can anyone suggest me a good option??

Share this post


Link to post
Share on other sites
Student_coder

Am stuck in between this script. Please let me know if there is any way to it.

Share this post


Link to post
Share on other sites
Jos

Where do I start..... 

  • Posting in the wrong forum.
  • Bumping within 24 minutes ( seriously??)
  • Multiple topic creation on the same subject.

so: start with reading the the forum rules before continuing posting in these forums and .. be patient!

Jos 

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Bowmore

Your function works for me. The slightly modified version below displays the result of the ping command in the message box.
Perhaps the problem is with the line GUICtrlSetData($Output,$text) but as I don;t have your GUI code I was unable to test that.

_getDOSOutput("Ping 204.79.197.200")
_getDOSOutput("Ping www.bing.com")
_getDOSOutput("Ping 192.168.1.72"); <===== Change this for something on your own network

Func _getDOSOutput($command)
Local $text = '', $Pid = Run(@ComSpec & ' /c ' & $command, '', @SW_HIDE, 2 + 4)
While 1

  $text &= StdoutRead($Pid)

  If @error Then ExitLoop
WEnd
;GUICtrlSetData($Output,$text)
MsgBox(0,"Ping Test",$text) ;<==== Just for testing
EndFunc;==>_getDOSOutput

 

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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

×