Sign in to follow this  
Followers 0
Anaken

Extended Send()

6 posts in this topic

The Send() function sends simulated keystrokes to the ACTIVE window.

How to send simulated keystrokes to the INACTIVE window by hwnd ?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

I tried to use it, but it didnt work.

#include <misc.au3>

_Main()

Func _Main()

    $hwnd = WinGetHandle("Mozilla Firefox")
    
    MsgBox(0,"Info", "Window handle is : " & $hwnd)
    
    $key = "^t"
    
    SendMyKey($hWnd, $key)
    
EndFunc

Func SendMyKey ($hwnd, $key)
    ControlSend($hwnd, "", "", $key)
    If @error Then
        MsgBox(0,"Error", "Error has occurred : " & @error)
        Exit
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

I am unsure of the usage with windows. The helpfile states:

ControlSend works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window

So I am assuming it works on windows. Also do a search (up in the top right corner) for "Send Inactive" or similar.

Share this post


Link to post
Share on other sites

Yeeaah! I has understood how to use it <_<

Share this post


Link to post
Share on other sites

Does somebody know why if I use the ControlSend function two or more times to send a key to an inactive window, then this window

activates. How to prevent that ?

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