AppleHead Posted September 28, 2009 Share Posted September 28, 2009 Hi, I want to be able to do what maybe is very very simple (thought not for me). I have a gui with an input box. All I want is that whatever is typed in the INPUT box...that data can be sent (using the SEND command) to any open window... For example...input box asks for a HOSTNAME. You input the hostname and click on the BUTTON called "ping test". It will then open a DOS window and send the command to the DOS window: Ping <whatever u typed as hostname> [RETURN] I have tried and tried but there is something wrong in the SEND input command. I have attached the script, please please can someone help me, have a look at the script and see what on earth is wrong. Thanks SarahPing Test.au3 Link to comment Share on other sites More sharing options...
smashly Posted September 28, 2009 Share Posted September 28, 2009 Hi,expandcollapse popup#include <GUIConstantsEx.au3> Opt("GUICoordMode", 2) Opt('MustDeclareVars', 1) Example1() ;Not using Send Example2() ;Using Send Func Example1() Local $Button, $Input, $msg, $iPID GUICreate("Ping Test - Not using Send", 515, 310, -1, -1) $Button = GUICtrlCreateButton("Ping Test", 10, 50, 125) $Input = GuiCtrlCreateInput("your host name", -1, 10, 350, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE If ProcessExists($iPID) Then ProcessClose($iPID) ExitLoop Case $Button $iPID = Run('cmd.exe /k ping ' & GUICtrlRead($Input)) EndSwitch WEnd EndFunc Func Example2() Local $Button, $Input, $msg, $iPID GUICreate("Ping Test - Using Send", 515, 310, -1, -1) $Button = GUICtrlCreateButton("Ping Test", 10, 50, 125) $Input = GuiCtrlCreateInput("your host name", -1, 10, 350, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE If ProcessExists($iPID) Then ProcessClose($iPID) ExitLoop Case $Button $iPID = Run('cmd.exe') Sleep(250) Send('ping' & GUICtrlRead($Input) & ' {ENTER}') EndSwitch WEnd EndFunc Cheers Link to comment Share on other sites More sharing options...
AppleHead Posted September 29, 2009 Author Share Posted September 29, 2009 You have given me the answer I was hunting for, for days. Thankyou and bless you. Link to comment Share on other sites More sharing options...
kjpolker Posted October 4, 2009 Share Posted October 4, 2009 (edited) Can you have it insert the input like in the middle of a line, like so it will type half a line of something, insert the input, than finish typing and hit enter. ex: Input says "Mountain Dew" Would you like a "input" or a Pepsi? My guess as of now is I could just do: Case $Button1 Send('Would you like a') Send('GUICtrlRead($Input)') Send('or a Pepsi?') Edited October 4, 2009 by kjpolker Link to comment Share on other sites More sharing options...
Gideon Posted October 6, 2009 Share Posted October 6, 2009 Why would you use the ping of windows while you can use ping() from autoit? Many times you need to think like hobby-bob:') Link to comment Share on other sites More sharing options...
GEOSoft Posted October 7, 2009 Share Posted October 7, 2009 Can you have it insert the input like in the middle of a line, like so it will type half a line of something, insert the input, than finish typing and hit enter. ex: Input says "Mountain Dew" Would you like a "input" or a Pepsi? My guess as of now is I could just do: Case $Button1 Send('Would you like a') Send('GUICtrlRead($Input)') Send('or a Pepsi?') Case $Button1 Send('Would you like a ' & GUICtrlRead($Input) & ' or a Pepsi?') George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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