Use AU3_Spy.exe which is included in AutoHotkey's installation folder to check all sorts of window info. I don't have Battlefield 1 so I can't tell you exactly what to type.
You could try making the window matching patterns more lenient by adding a few lines to get around the TM symbol. Or use something else to recognize it, such as the executable name. Try something like this maybe:
Code: Select all
SetTitleMatchMode, 2
SetTitleMatchMode, Slow
DetectHiddenWindows, On
Loop
{
WinActivate ahk_exe BF1.exe
Sleep,1500
;keys to send
}
I also recommend you to read ControlSend's documentation which is capable of sending keys to a background process. Not many games may support it, but it's worth a try.
Code: Select all
SetTitleMatchMode, 2
SetTitleMatchMode, Slow
DetectHiddenWindows, On
Loop
{
ControlSend,,{l down},ahk_exe BF1.exe
Sleep,50
ControlSend,,{l up},ahk_exe BF1.exe
Sleep,20000
ControlSend,,{l down},ahk_exe BF1.exe
Sleep,50
ControlSend,,{l up},ahk_exe BF1.exe
Sleep,20000
ControlSend,,{enter down},ahk_exe BF1.exe
Sleep,50
ControlSend,,{enter up},ahk_exe BF1.exe
Sleep,20000
}