Page 1 of 1

Send keys to inactive window

Posted: 29 Mar 2024, 10:59
by MulPen
Hello!

I created a simple script to spam only one key in a specific interval, but of course this only works when the window is active, is there a way to continue sending this key when I minimize the window? I read a little about PID and ControlSend() function but couldn't figure it out how to apply on my case.

The game process is always "UOF.exe" if this helps...

Here's my script:

Code: Select all

#NoEnv
#MaxThreadsPerHotkey 2
toggle := 0

z::
    Toggle := !Toggle
    While Toggle
    {
	Send, {F1 down}
	Sleep, 20
	Send, {F1 up}
	Sleep, 30
    }
return
[Mod edit: Moved topic from AHK v2 help since this v1 code.]

Re: Send keys to inactive window

Posted: 30 Mar 2024, 01:44
by gregster
There is also a v2 version of this question: viewtopic.php?f=94&t=128031