I have written a little script that switches between two PS2 game windows. Each window is a different faction. The two players are standing around a generator, and it goes back and fourth, one overloading a generator, and the other player stabilising the generator. In theory. The script just activates a window, sends the E key for 10 seconds, then switches to the other window and does it again. Over and over. However, only the one window registers the E press. So what happens, is player one has its window activated, and presses E and overloads the generator. Then player two's window gets activated, but for some reason, the client does not recognise the sent E. In fact, it does not recognise any event sent by the script. I can manually press E and it works fine, but the script does not. I have tried focusing on other windows before I focus on the second window, I have tried sending more then one E press, nothing works. The second window does not recognise any input from the script. Logically it is sound, but I really need some help because for some reason it does not work and I am stumped.
Code:
Sleep(1000)
Opt("SendKeyDownDelay", 10000)
$shooter1 = "0x0000000000160442"
$shooter2 = "0x00000000002D04DE"
While 1=1
WinActivate(HWnd($shooter1))
Sleep(500)
Send("e")
Sleep(100)
WinActivate(HWnd($shooter2))
sleep(500)
Send("e")
Sleep(100)
WEnd






