I'm trying to make a macro in Fallout 76 and so far simple commands such as "send" worked fine (the game accepts that). I'm trying to improve my code and what I'm trying to do below is:
1) Get the current ID (HWND) of the game's window from the list of all windows
2) keep it as a "CurrentID" variable
3) Repeatedly send "press w key" only to that window (while I'm doing sth else in another window)
I tried to use hints from the manual (https://www.autohotkey.com/docs/commands/WinGet.htm,), it seems simple, but there must be a mistake somewhere - because the game doesn't react to this I used the "Windows Spy" to get the name of the window - it's simply "Fallout76"
Any hints?:
Code: Select all
F1::
WinGet, CurrentID, List, Fallout76
Loop
{
ControlSend,,{w down}, ahk_id %CurrentID%
Sleep 500
ControlSend,,{w up}, ahk_id %CurrentID%
Sleep 1000
}
F2::pause