Here's a working Anti-AFK that can work in the background
Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
global $gRun
Global $hWnd
global $afkMsg
Global $mainGUI = GUICreate("KFA", 50, 70, 25, 25, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_DLGFRAME, $WS_POPUP, $WS_GROUP, $WS_CLIPSIBLINGS))
$btnStart = GUICtrlCreateButton("Start", 0, 0, 50, 35)
$btnStop = GUICtrlCreateButton("Exit",0,35,50,35)
*****tState(@SW_SHOW)
While 1
$runMsg = GUIGetMsg()
Switch $runMsg
Case $btnStart
afkRun()
Case $btnStop
Exit
endSwitch
WEnd
func afkRun()
Local $afkKeys[4]
$afkKeys[1] = "W"
$afkKeys[2] = "S"
$afkKeys[3] = "{SPACE}"
$hWnd = WinGetHandle("World of Warcraft")
MsgBox(1, "", $hWnd)
while 1
$i = Random(1,3,1)
ControlSend("World of Warcraft", "", $hWnd, $afkKeys[$i])
Sleep(50)
ControlSend("World of Warcraft", "", $hWnd, $afkKeys[$i])
$afkMsg = GUIGetMsg()
Switch $afkMsg
Case $btnStop
Exit
endSwitch
sleep(1000*150)
wend
EndFunc
Replace '*****tState(@SW_SHOW)' with 'G.U.I.S.e.t.State(@SW_SHOW)' minus the '.'
Pastebin - pastebin.com/f53077f97