qwert Posted March 10, 2008 Share Posted March 10, 2008 Can anyone point me to a simple example of one AutoIt script sending a text message to a different AutoIt GUI (that's already running, of course). I'm trying to learn this aspect of scripting and haven't gotten very far. I've run an example that does a simple Send to Notepad, so I understand some of the basics. But what is the proper way for the sending script to address a specific control (e.g., an edit field) in the external script? The code examples I've found so far haven't worked for me ... and _SendMessage seems too complicated for this simple operation. Thanks for any help. Link to comment Share on other sites More sharing options...
LinuZ Posted March 10, 2008 Share Posted March 10, 2008 (edited) Use ControlSendControlSend( "GUI title", "", $controlIDtoSendto, "stringtosend") Edited March 10, 2008 by LinuZ Link to comment Share on other sites More sharing options...
qwert Posted March 10, 2008 Author Share Posted March 10, 2008 $controlIDtoSendto That's my main question. How do I get $controlIDtoSendto? Link to comment Share on other sites More sharing options...
LinuZ Posted March 10, 2008 Share Posted March 10, 2008 (edited) If you have made the GUI in the same script then it comes from: $myedit=GUICtrlCreateEdit ("First line"& @CRLF, 176,32,121,97,$ES_AUTOVSCROLL+$WS_VSCROLL) ControlSend( "GUI title", "", $myedit, "stringtosend") You can use the variable for the guictrl as the control handle. If this control is in an external program then you can get the handle with the AutoIt Window Info program that comes with the autoit package. If we take it in notepad it is "Edit1" (ClassnameNN) Send to notepad window: ControlSend( "Untitled - Notepad", "", "Edit1", "Blah blah blah{ENTER}BLAAAAh") Edited March 10, 2008 by LinuZ Link to comment Share on other sites More sharing options...
qwert Posted March 10, 2008 Author Share Posted March 10, 2008 If this control is in an external program then you can get the handle with the AutoIt Window Info program that comes with the autoit package.The external program is another AutoIt script that creates a GUI. I've tried using the Window Name and Control ID read by the AutoIt Info program, but (using them) nothing is sent across and (as a debug check) no handle is returned by the simple statement: $handle = ControlGetHandle("Display", "", "Edit1") when I include it in the sending script.So I guess my request is still: is there a simple example posted somewhere? Thanks very much for responding. 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