Sign in to follow this  
Followers 0
kamyers1

ControlSend without a Control Name

4 posts in this topic

#1 ·  Posted (edited)

I was doing some testing, using AutoItX to control Windows Notepad, when I happened to find that the follow unexpectedly worked:

set AutoIt=WScript.CreateObject("AutoItX3.Control")

AppWindowName="Untitled - Notepad"

AutoIt.ControlSend AppWindowName,"","","^o"

Can someone please explain exactly what this (using ControlSend without a control name) actually does? Does it send directly to the application window, or to the first child window of the application window, or something else?

The reason that I care is that I am looking hard for some way to send accelerator keystrokes to inactive windows. Since the windows are inactive, Send won't do the job, and I can't find the appropriate control to send accelerator keys to for some applications. So, if ControlSend without a control name is actually sending to the application window itself, or to some control that is set by default to receive keystrokes for the application, then using ControlSend in this manner *might* solve some of my problems. On the other hand, if this use of ControlSend is simply sending keystrokes to the *first* child control of the application window, then that most likely won't do me any good in general.

Thanks,

Kevin M.

Edited by kamyers1

Share this post


Link to post
Share on other sites



It's very likely that it sends directly to the window, or to the control with focus.

Share this post


Link to post
Share on other sites

Right, but I think that I would appreciate a more definitive answer, from someone in the know if possible. By the way, I don't think that the two possibilities you mentioned are technically equivalent, are they? If not, then it could matter to users which one of these is really happening.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

They aren't the same, no, but if you are firing an event that gets translated to an accelerator, it will end up being consumed by the window anyways, right?

Keep in mind that the window itself rarely has focus. It's usually a control in the window that does.

Edited by Richard Robertson

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