ermilemerson Posted June 24, 2009 Share Posted June 24, 2009 Good day everyone Can you pls. help me on how am i going to enter to command promt what i've entered on the GUICtrlInput. $variable = GUICtrlCreateInput("", 90, 40, 70, 17) will i use controlsend or send? tnxtnx Link to comment Share on other sites More sharing options...
Authenticity Posted June 24, 2009 Share Posted June 24, 2009 Neither: #include <Constants.au3> #include <GUIConstantsEx.au3> Dim $hGUI = GUICreate('Test', 230, 300) Dim $Input = GUICtrlCreateInput('dir /b C:\', 10, 10, 220, 23) Dim $Button = GUICtrlCreateButton('Run', 80, 38, 70, 23) Dim $Output = GUICtrlCreateEdit('...', 10, 76, 220, 214) Dim $sOutput Dim $CmdID GUISetState() While 1 Switch GUIGetMsg() Case $Button $CmdID = Run(@ComSpec & ' /c ' & GUICtrlRead($Input), '', @SW_HIDE, BitOR($STDIN_CHILD, $STDOUT_CHILD)) $sOutput = '' While 1 $sOutput &= StdoutRead($CmdID) If @error Then ExitLoop Wend GUICtrlSetData($Output, $sOutput) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() Exit Link to comment Share on other sites More sharing options...
ermilemerson Posted June 24, 2009 Author Share Posted June 24, 2009 uhm, may i have it this way? a GUICtrlInput box will appear then I will enter name of a computer (e.g. emerson) then a variable will store what i have entered ( e.g. $variable = GUICtrlCreateInput("", 90, 40, 70, 17) ) then i will load the data stored in the $variable like this Run("cmd.exe") WinWaitActive("C:\WINDOWS\system32\cmd.exe") send("ping""{"& $variable &"}") this script isn't working. can you help me figure out what to do. i want the output to be like this C:\ping emerson thank you very much Link to comment Share on other sites More sharing options...
Authenticity Posted June 24, 2009 Share Posted June 24, 2009 So the input box should contain an IP address? Easy, just modify the script to: ; ... $CmdID = Run(@ComSpec & ' /c ping ' & GUICtrlRead($Input), '', @SW_HIDE, BitOr($STDIN_CHILD, $STDOUT_CHILD)) Link to comment Share on other sites More sharing options...
KenNichols Posted June 24, 2009 Share Posted June 24, 2009 I added to Authenticity's code. #include <Constants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <WindowsConstants.au3> Dim $hGUI = GUICreate('Test', 310, 300) Dim $Input = _GUICtrlIpAddress_Create($hGUI, 65, 10, 180, 23) _GUICtrlIpAddress_Set($Input, "0.0.0.0") Dim $Button = GUICtrlCreateButton('Run', 120, 38, 70, 23) Dim $Output = GUICtrlCreateEdit('...', 10, 76, 290, 214) Dim $sOutput Dim $CmdID GUISetState() While 1 Switch GUIGetMsg() Case $Button $CmdID = Run(@ComSpec & ' /c ping ' & _GUICtrlIpAddress_Get($Input), '', @SW_HIDE, BitOr($STDIN_CHILD, $STDOUT_CHILD)) $sOutput = '' While 1 $sOutput &= StdoutRead($CmdID) If @error Then ExitLoop Wend GUICtrlSetData($Output, $sOutput) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete() Exit [topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner! Link to comment Share on other sites More sharing options...
ermilemerson Posted June 25, 2009 Author Share Posted June 25, 2009 thank you very much authenticity and ken 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