Jump to content

Recommended Posts

Posted

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

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

Posted
Posted

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
Posted

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.

Posted

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 ?

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
×
×
  • Create New...