Jump to content
Sign in to follow this  
Anaken

Extended Send()

Recommended Posts

Anaken

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
BrettF

Share this post


Link to post
Share on other sites
Anaken

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
BrettF

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
Anaken

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.