Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MarkMichon1/8fa420af5834e9861298ca8bca19194e to your computer and use it in GitHub Desktop.
Save MarkMichon1/8fa420af5834e9861298ca8bca19194e to your computer and use it in GitHub Desktop.
Anti AFK Script
from pynput.keyboard import Controller
import random
import time
key_press_dict = {
0 : 'w',
1 : 'a',
2 : 's',
3 : 'd'
}
# Virtual keyboard initialization
keyboard = Controller()
while True: # Loop until time depletes
random_key_press = key_press_dict[random.randint(0,3)]
print(random_key_press)
keyboard.press(random_key_press)
time.sleep(random.uniform(.18, .5))
keyboard.release(random_key_press)
@s1mplus
Copy link

s1mplus commented Mar 28, 2022

Ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment