Code: Select all
;----------
F11:: ; your hotkey
{
;Gui, New[,Options, title]
MsgBox, "Enabled"
active:=!active ;toggles active
while, active ; while, condition
{
;WinGet, OutputVar, IDLast , WinTitle, WinText, ExcludeTitle, ExcludeText
WinGet, id, list, ahk_exe Gw2-64.exe,
Loop, %id%
{
Sleep, 1000
this_id := id%A_Index%
;Anti-AFK Function
{
ControlSend,, ahk_id %this_id%, {Space}
}
Sleep, 1000
}
;MsgBox, "AFK-kick prevented"
;delays execution by 1 hour to 2 hours.
random, delay, 5000000, 10000000
Sleep, %delay%
}
MsgBox, "Disabled"
}
;----------
Any way to make GW2 responsive to ControlSend?
Would programming directly with the WinAPI make it easier to do this?
It would be better if I could make it so the window doesn't have to pop up.
PS: Yes the Autohotkey Script is running in admin mode.