The usual way would be to follow your own script, line by line; instead of running it, execute each action manually, including the sleeps. See if the same problem occurs. If so, then you know that the fix is easy: you simply need to revise your code to match a working sequence. If the problem does not occur, then see where the key history might differ from your manual sequence, after you run the script.
When you run this script, I think I would assign a hotkey to your routine, so that you can trigger it with the hotkey.
Some windows do not respond to ControlSend, so another test you can do is use Send instead of ControlSend. Keep your target window active when you do that. This will simplify your testing and will help you understand whether you can develop a set of sequences that work in AHK. ControlSend complicates the picture, so you can eliminate it in your testing.
Rohwedder points out that a long key delay can also be problematic, so I would eliminate that. It is probably a mistake anyway in your script, as you already have a sleep for the same duration.
Code: Select all
#IfWinExist Game
F3::
WinActivate ; Activate the game
SoundBeep, 1500
Send {Right down}
Sleep, 10000
Send {Right up}
Sleep, 1000
Send {Left down}
Sleep, 10000
Send {Left up}
MsgBox, 64, Done, Done!, 1
Return
#IfWinExist
During this test, let the game window remain active until the hotkey routine ends.