Advertisement
Guest User

Untitled

a guest
Nov 27th, 2016
8,373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. antiafk.ahk:
  2. [CODE]
  3. THE_KEY_YOU_WANT_PRESS_AFTER_13_MINUTES = z ; Or y on QWERTZ, best option, didn't make any problems and prevent AFK.
  4. GameTitle = Grand Theft Auto V
  5. WinGet, PID, pid, %GameTitle%
  6. GTAPid := pid
  7. Ticks := A_TickCount
  8. while(pid > 0) ; While GTA is running
  9. {
  10.     if (A_TickCount - Ticks > 780000) ; 13 Minutes
  11.     {
  12.         WinGet, PID ,pid , A
  13.         if (GTAPid != pid) ; Activate GTA Window is not in Foreground
  14.         {
  15.             WinActivate, %GameTitle%
  16.             sleep 2000
  17.         } ; Send Key
  18.         Send {%THE_KEY_YOU_WANT_PRESS_AFTER_13_MINUTES% down}
  19.         sleep 10
  20.         send {%THE_KEY_YOU_WANT_PRESS_AFTER_13_MINUTES% up}
  21.         Ticks := A_TickCount ; Reset Ticks 
  22.     }
  23.     WinGet, PID, pid, %GameTitle% ; Check if GTA is still running
  24. }
  25. [/CODE]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement