emkay443

antiafk

Sep 16th, 2013
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.76 KB | None | 0 0
  1. #!/bin/bash
  2. # Simple Anti-AFK script for World of Warcraft
  3. #
  4. # Author: Michael Koch
  5. # Version: 2013-09-23
  6. # License: GPL v3
  7.  
  8. if [ -t 0 ]; then
  9.     if [[ ! "$(which xte)" ]]; then
  10.         echo "xautomation needs to be installed."
  11.         sudo apt-get install xautomation
  12.     fi
  13.     if [[ ! "$(which xdotool)" ]]; then
  14.         echo "xdotool needs to be installed."
  15.         sudo apt-get install xdotool
  16.     fi
  17.  
  18.     while true; do
  19.         window_title="$(xdotool getwindowname $(xdotool getwindowfocus))"  
  20.         if [[ ! "$window_title" == "World of Warcraft" ]]; then
  21.             echo "WoW is NOT focused!"
  22.             sleep 2
  23.         else
  24.             echo "WoW is focused. Doing anti-afk stuffery."
  25.             xte "keydown w"
  26.             xte "keyup w"
  27.             xte "keydown s"
  28.             xte "keyup s"
  29.             sleep 600
  30.         fi
  31.     done
  32. else
  33.     x-terminal-emulator -e "$0"
  34. fi
Advertisement
Add Comment
Please, Sign In to add comment