Closed vfptr closed 3 months ago
The way you do this is through the send
method of the Window
class. Doing a long press works the same way as described in the docs describing Repeating or Holding Down a Key. (these features also work with ControlSend
, which is the underlying functionality of Window.send
).
For example, the AutoHotkey documentation provides:
Send {Up down} ; Presses down the up-arrow key.
Sleep 1000 ; Keeps it down for one second.
Send {Up up} ; Releases the up-arrow key.
Using the wrapper, the equivalent doing what you want to a window that is not active:
win = ahk.win_get(title='my window')
win.send('{Up down}')
time.sleep(1)
win.send('{Up up}')
Keep in mind, some windows (especially games) may simply not accept input at all while the window is not active.
Thank you very much for your answer
Checked the documentation
describe your feature request
I want to simulate long press event by sending keys release or press event to a not activated window. I did not find any way to do this in AHK.Window class.