Jump to content
Sign in to follow this  

Need help with using ControlSend() codes.

Recommended Posts


I'm a beginner with Autoit and i've decided to learn more about Control functions.

I've made a simple macro for a text-browser named Lynx, to be more precise, it's a browser in command line, i used only ControlSend function because that browser is navigated by keyboard only, and my simple macro works well.

However, i got the idea to try and run 2 instances of Lynx and try to macro them both at the same time. I copied and changed name of my script, changed the Hotkey to trigger the start of the script, but it doesn't work, both scripts send keystrokes to the same instance of the program.

That's most probably because both programs have the same Title, can i use ControlSend to a program not recognised by title, but by something else, maybe by Handle, their handles are different. Here is the browser's Window Info :

>>>> Window <<<<

Title: http://www.google.com/imghp?hl=en&tab=wi

Class: ConsoleWindowClass

Position: 23, 69

Size: 652, 338

Style: 0x15CF0000

ExStyle: 0x00040310

Handle: 0x002604CE

>>>> Control <<<<




Advanced (Class):





ControlClick Coords:



Handle: 0x001503E4

>>>> Mouse <<<<

Position: 522, 261

Cursor ID: 15

Color: 0xC0C0C0

Share this post

Link to post
Share on other sites

To lay it simple, i want to use ControlSend() to 2 instances of the same program with the same title.

Share this post

Link to post
Share on other sites

Read the help file under "Window Titles and Text (Advanced)". You just need to be more specific about which window are addressing. You could go with these for instance:

ControlSend("[CLASS:ConsoleWindowClass; INSTANCE:1]", "", "^A") ; Jump first instance to beginning of text
ControlSend("[CLASS:ConsoleWindowClass; INSTANCE:2]", "", "^E") ; Jump second instance to end of text

Each window also has a unique handle, the most reliable option is to get the handle when you create the window (open the console) and use that instead of a title string.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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