# Jiggler Mouse

```
import pyautogui
import random
import time
import keyboard

try:
    while True:
        # Check if F11 is pressed to exit
        if keyboard.is_pressed('F11'):
            print("F11 key pressed. Exiting.")
            break

        # Move the mouse cursor randomly
        x_offset = random.randint(-250, 250)
        y_offset = random.randint(-250, 250)
        try:
            pyautogui.moveRel(x_offset, y_offset, duration=0.25)
        except pyautogui.FailSafeException:
            print("Mouse movement failed or reached screen edge. Exiting.")
            break
        time.sleep(0.1)
except ImportError as e:
    print(f"An error occurred: {str(e)}. Please ensure 'pyautogui' and 'keyboard' are installed.")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://itrp19-notes.gitbook.io/notes/reference/python3/code-projects/jiggler-mouse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
