This Python script demonstrates cursor control and prediction using machine learning models. It captures cursor movement, mouse clicks, and screen pixels to train and predict cursor angle, speed, and button clicks.
Ensure you have the following Python libraries installed:
pip install pyautogui
pip install pynput
pip install pillow
pip install pandas
pip install numpy
pip install scikit-learn
-
Define Screen Size: Set the
SCREEN_WIDTH
andSCREEN_HEIGHT
variables according to your screen dimensions. -
Download Pre-built Executable:
- You can download the pre-built executable version of this script from this link.
- Install the executable locally.
-
Run the Script: Execute the script using Python:
python ComputerMouseSimulation.py
-
Cursor Movement and Prediction: The script will capture cursor movement and screen pixels, predict cursor angle, speed, and button clicks using trained models, and simulate cursor movement accordingly.
-
Keyboard Interrupt (Ctrl+C): To stop the script, use a keyboard interrupt (Ctrl+C). The script will print non-RGB data collected during execution.
Note: This script uses machine learning models to predict cursor behavior. Make sure to train the models before running the script for accurate predictions.
- The
initialize_dataset
function sets up the initial dataset structure. - RandomForest models are initialized using the
initialize_randomforest_models
function. - Cursor movement and screen pixels are captured in the
get_cursor_position_and_movement
andget_screenshot
functions. - The
train_randomforest_models
function trains the Random Forest models using the dataset. - Prediction functions (
predict_cursor_angle
,predict_cursor_speed
,predict_cursor_button
) predict cursor behavior based on the captured data. - The
set_cursor_movement
andset_cursor_button
functions simulate cursor movement and button clicks.
Feel free to modify the script according to your requirements and integrate it into your projects.