From a couple threads seen there's a want for anti-afk scripting, surprised most don't know just doing this from autoit, but anyway..
This is what I have set up when I'd like to just stay on. This should be self explanatory, but just wait til the GTAV window is active, hit pagedown key to activate, end key to stop, if you tab out use the antiidle hotkey again.
Download the latest autoit, save this as an *.au3 file, compile and use the exe, or just run it.
Code:
#include <AutoItConstants.au3>
Global $Paused = False
;The below turn anti-idle on or off, should you have tabbed out, you'll need to push this hotkey again.
HotKeySet("{PGDN}","antiidle")
HotKeySet("{END}", "pauseantiidle")
WinWaitActive("Grand Theft Auto V")
While WinActive ("Grand Theft Auto V")
If WinActive ("Grand Theft Auto V") Then
Func antiidle()
While WinActive ("Grand Theft Auto V")
Send("{z 1}")
Sleep(1000)
Wend
EndFunc
Func pauseantiidle()
$Paused = Not $Paused
While $Paused
Sleep(500)
WEnd
EndFunc
Else
; if you tab out it will automatically pause
WinWaitActive ("Grand Theft Auto V", "")
Endif
Wend