Sign in to follow this  
Followers 0
qwert

Need basic example of Send to external app

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use ControlSend

ControlSend( "GUI title", "", $controlIDtoSendto, "stringtosend")
Edited by LinuZ

Share this post


Link to post
Share on other sites

$controlIDtoSendto

That's my main question. How do I get $controlIDtoSendto?

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by LinuZ

Share this post


Link to post
Share on other sites

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.

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
Sign in to follow this  
Followers 0