This script simulates mouse movements and key presses to prevent your system from going idle. It is designed to be used in situations where you want to avoid being logged out or kicked from a game due to inactivity.
- Monitors mouse movement and idle time.
- Moves the mouse and presses random keys when idle for a set threshold.
- Configurable idle time threshold and key actions.
- Supports screen resolutions based on your display size.
- Python 3.x
pydirectinput
library (for simulating mouse and keyboard actions)
- Install Python 3.x (if not already installed).
- Install the required library using pip:
pip install pydirectinput
-
Run the script:
python anti_afk.py
Alternatively, just double-click
start.cmd
-
The script will monitor your system for idle time. If no mouse movement is detected for a specified period, it will simulate random mouse movements and key presses.
-
Press
Ctrl + C
to stop the script.
afk_threshold
: The time (in seconds) of inactivity before the script triggers actions.keys
: The list of keys that can be randomly pressed (e.g.,['w', 'a', 's', 'd', 'space']
).