# Mouse Anywhere
Mouse Anywhere is a powerful and flexible DLL library designed to provide advanced mouse control functionalities on Windows platforms. Whether you're developing automation scripts, creating custom user interfaces, or enhancing accessibility features, Mouse Anywhere offers a comprehensive set of tools to manipulate mouse movements and actions with precision and ease.
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [Installation via pip](#installation-via-pip)
- [Building the DLL Manually](#building-the-dll-manually)
- [Using the Python Wrapper](#using-the-python-wrapper)
- [Usage](#usage)
- [Initialization and Shutdown](#initialization-and-shutdown)
- [Cursor Control](#cursor-control)
- [Mouse Clicks](#mouse-clicks)
- [Hold and Move](#hold-and-move)
- [Configuration](#configuration)
- [Presets](#presets)
- [Logging](#logging)
- [API Reference](#api-reference)
- [Exported Functions](#exported-functions)
- [Configuration Parameters](#configuration-parameters)
- [Easing Types](#easing-types)
- [Preset Types](#preset-types)
- [Log Levels](#log-levels)
- [How It Works](#how-it-works)
- [Logging](#logging)
- [Error Handling](#error-handling)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
- [Example Usage](#example-usage)
- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq)
- [Contact](#contact)
---
## Features
- **Absolute Cursor Positioning:** Move the mouse cursor to any position on the screen, with optional smooth transitions.
- **Mouse Clicks:** Perform left, right, and middle mouse clicks with configurable hold times.
- **Hold and Move:** Hold down a mouse button while moving the cursor, useful for drag-and-drop operations.
- **Configuration Options:** Customize strength, hold time, mouse speed, easing types, and smooth movement.
- **Presets:** Apply predefined configurations for default, fast, or smooth mouse behavior.
- **Logging:** Detailed logging with configurable log levels to monitor actions and debug issues.
- **Thread-Safe:** Utilizes critical sections to manage concurrent access to global parameters.
---
## Installation
Mouse Anywhere can be installed either via `pip` for ease of use or built manually from the source for customization. Choose the method that best fits your needs.
### Prerequisites
- **Operating System:** Windows (tested on Windows 10 and later)
- **Development Tools:** Microsoft Visual Studio or any C/C++ compiler supporting Windows DLLs (only if building manually)
- **Python:** Python 3.6 or later (for using the Python wrapper)
- **Dependencies:** None beyond standard C libraries and Python's `ctypes` module
### Installation via pip
For a straightforward installation, you can install Mouse Anywhere directly from PyPI using `pip`. This method is recommended for most users as it simplifies the setup process.
1. **Install via pip:**
Open your command prompt or terminal and run:
```bash
pip install mouse-anywhere
```
2. **Verify Installation:**
After installation, you can verify by importing the module in Python:
```python
import mouse_anywhere as mouse
```
3. **Note:**
The `pip` installation includes the pre-built `mouse_anywhere.dll`. Ensure that your system meets the necessary prerequisites, and you have the appropriate permissions to install Python packages.
### Building the DLL Manually
If you prefer to build the DLL from the source, perhaps to customize functionalities or verify the source code, follow these steps:
1. **Clone the Repository:**
```bash
git clone https://github.com/wuhplaptop/mouse-anywhere.git
```
2. **Open the Project:**
Open the project in your preferred C/C++ development environment. For example, using Visual Studio:
- Open Visual Studio.
- Select **File > Open > Project/Solution**.
- Navigate to the cloned repository and open the `.sln` file if available, or create a new DLL project and add the provided `mouse_anywhere.c` file.
3. **Build the DLL:**
- Configure the build settings as needed (e.g., Release mode).
- Build the project to generate `mouse_anywhere.dll`.
4. **Locate the DLL:**
After a successful build, locate the `mouse_anywhere.dll` in the project's output directory (e.g., `Debug` or `Release`).
### Using the Python Wrapper
Whether you installed via `pip` or built the DLL manually, you can utilize the Python wrapper to interact with Mouse Anywhere seamlessly.
1. **Ensure the DLL is Accessible:**
- **If Installed via pip:** The DLL is included and should be accessible automatically.
- **If Built Manually:** Place the `mouse_anywhere.dll` in the same directory as your Python script or in a directory that's part of your system's PATH.
2. **Install Python (if not already installed):**
Download and install Python from the [official website](https://www.python.org/downloads/).
3. **Using the Wrapper:**
Here's a basic example of how to use the Python wrapper:
```python
import mouse_anywhere as mouse
# Initialize the library
mouse.initialize()
# Set cursor to position (500, 500)
mouse.set_cursor_abs(500, 500)
# Perform a left click
mouse.click(1)
# Shutdown the library
mouse.mouse_shutdown()
```
Replace `mouse_anywhere` with the actual name of your Python wrapper file if different.
---
## Usage
### Initialization and Shutdown
Before performing any mouse operations, initialize the library. After completing your tasks, ensure you properly shut down the library to release resources.
#### C Example
```c
#include "mouse_anywhere.h"
int main() {
initialize();
// Perform mouse operations here
mouse_shutdown();
return 0;
}
```
#### Python Example
```python
import mouse_anywhere as mouse
mouse.initialize()
# Perform mouse operations here
mouse.mouse_shutdown()
```
### Cursor Control
#### Set Cursor to Absolute Position
Move the cursor to a specific (x, y) coordinate on the screen.
##### C Example
```c
set_cursor_abs(1000, 500);
```
##### Python Example
```python
mouse.set_cursor_abs(1000, 500)
```
#### Smooth Movement
Enable or disable smooth cursor transitions by configuring the `smooth_movement` parameter.
### Mouse Clicks
#### Perform a Click
Simulate a mouse button click. Supported buttons are:
- `1` - Left Click
- `2` - Right Click
- `3` - Middle Click
##### C Example
```c
click(1); // Left Click
```
##### Python Example
```python
mouse.click(1) # Left Click
```
#### Configurable Hold Time
Set how long the mouse button is held down during a click.
```c
// C Example
set_config(50, 300, 5, EASE_LINEAR, true); // strength, hold_time_ms, mouse_speed, easing_type, smooth_movement
```
### Hold and Move
Hold down a mouse button while moving the cursor to perform drag operations.
##### C Example
```c
hold_and_move(1500, 1000, 1, 2000); // x, y, button, duration_ms
```
##### Python Example
```python
mouse.hold_and_move(1500, 1000, 1, 2000) # x, y, button, duration_ms
```
### Configuration
Customize the mouse behavior by setting configuration parameters:
- **Strength:** Determines the number of steps in movement. Range: `1` to `100`.
- **Hold Time (ms):** Duration to hold mouse clicks.
- **Mouse Speed (ms per step):** Speed of cursor movement.
- **Easing Type:** Type of easing function for smooth transitions.
- **Smooth Movement:** Enable or disable smooth cursor movement.
##### C Example
```c
set_config(70, 200, 3, EASE_QUADRATIC, false);
```
##### Python Example
```python
mouse.set_config(70, 200, 3, 2, False) # strength, hold_time_ms, mouse_speed, easing_type, smooth_movement
```
### Presets
Apply predefined configurations for common use cases:
- `1` - Default
- `2` - Fast
- `3` - Smooth
##### C Example
```c
apply_preset(PRESET_FAST);
```
##### Python Example
```python
mouse.apply_preset(2) # Fast preset
```
### Logging
Enable and configure logging to monitor actions and debug issues. Set the logging level:
- `0` - None
- `1` - Error
- `2` - Info
- `3` - Debug
##### C Example
```c
set_logging_level(LOG_LEVEL_DEBUG);
```
##### Python Example
```python
mouse.set_logging_level(3) # Debug level
```
Logs are written to `mouse_movement.log` in the application's directory.
---
## API Reference
### Exported Functions
#### `initialize()`
**Description:**
Initializes the Mouse Anywhere library. Must be called before any other functions.
**Usage:**
```c
initialize();
```
```python
mouse.initialize()
```
#### `mouse_shutdown()`
**Description:**
Shuts down the Mouse Anywhere library and releases resources.
**Usage:**
```c
mouse_shutdown();
```
```python
mouse.mouse_shutdown()
```
#### `set_cursor_abs(int x, int y)`
**Description:**
Moves the cursor to the specified absolute (x, y) screen coordinates.
**Parameters:**
- `x` (`int`): The x-coordinate on the screen.
- `y` (`int`): The y-coordinate on the screen.
**Usage:**
```c
set_cursor_abs(800, 600);
```
```python
mouse.set_cursor_abs(800, 600)
```
#### `click(int button)`
**Description:**
Performs a mouse button click.
**Parameters:**
- `button` (`int`): The mouse button to click.
- `1` - Left Click
- `2` - Right Click
- `3` - Middle Click
**Usage:**
```c
click(1); // Left Click
```
```python
mouse.click(1) # Left Click
```
#### `hold_and_move(int x, int y, int button, int duration_ms)`
**Description:**
Holds down a specified mouse button and moves the cursor to the target (x, y) position over the specified duration.
**Parameters:**
- `x` (`int`): The target x-coordinate.
- `y` (`int`): The target y-coordinate.
- `button` (`int`): The mouse button to hold.
- `1` - Left Click
- `2` - Right Click
- `3` - Middle Click
- `duration_ms` (`int`): Duration in milliseconds for the movement.
**Usage:**
```c
hold_and_move(1200, 800, 1, 1500); // Hold left button and move
```
```python
mouse.hold_and_move(1200, 800, 1, 1500) # Hold left button and move
```
#### `set_mouse_speed(int speed)`
**Description:**
Sets the speed of mouse movement in milliseconds per step.
**Parameters:**
- `speed` (`int`): Mouse speed. Must be greater than `0`.
**Usage:**
```c
set_mouse_speed(10);
```
```python
mouse.set_mouse_speed(10)
```
#### `set_config(int strength, int hold_time_ms, int mouse_speed, int easing_type, bool smooth_movement)`
**Description:**
Configures the mouse behavior with custom settings.
**Parameters:**
- `strength` (`int`): Movement strength (1-100).
- `hold_time_ms` (`int`): Hold time for clicks in milliseconds.
- `mouse_speed` (`int`): Speed of mouse movement in ms per step.
- `easing_type` (`int`): Type of easing function.
- `1` - Linear
- `2` - Quadratic
- `3` - Sinusoidal
- `4` - Cubic
- `5` - Exponential
- `smooth_movement` (`bool`): Enable (`true`) or disable (`false`) smooth movement.
**Usage:**
```c
set_config(60, 250, 5, 3, true);
```
```python
mouse.set_config(60, 250, 5, 3, True)
```
#### `apply_preset(int preset_type)`
**Description:**
Applies a preset configuration.
**Parameters:**
- `preset_type` (`int`):
- `1` - Default
- `2` - Fast
- `3` - Smooth
**Usage:**
```c
apply_preset(3); // Apply Smooth preset
```
```python
mouse.apply_preset(3) # Apply Smooth preset
```
#### `set_logging_level(int level)`
**Description:**
Sets the logging level for the library.
**Parameters:**
- `level` (`int`):
- `0` - None
- `1` - Error
- `2` - Info
- `3` - Debug
**Usage:**
```c
set_logging_level(2); // Set to Info level
```
```python
mouse.set_logging_level(2) # Set to Info level
```
### Configuration Parameters
- **Strength (`strength`):**
Determines the number of steps in mouse movement. Higher values result in smoother and longer transitions.
- **Hold Time (`hold_time_ms`):**
Duration in milliseconds to hold a mouse button down during a click.
- **Mouse Speed (`mouse_speed`):**
Speed of mouse movement in milliseconds per step. Lower values result in faster movement.
- **Easing Type (`easing_type`):**
Defines the easing function for smooth cursor transitions. Available types:
| Value | Type |
|-------|---------------|
| 1 | Linear |
| 2 | Quadratic |
| 3 | Sinusoidal |
| 4 | Cubic |
| 5 | Exponential |
- **Smooth Movement (`smooth_movement`):**
Enables (`true`) or disables (`false`) smooth cursor movement.
### Easing Types
Easing functions control the acceleration and deceleration of cursor movements. They provide more natural and visually appealing transitions.
1. **Linear (`EASE_LINEAR`):**
Constant speed from start to finish.
2. **Quadratic (`EASE_QUADRATIC`):**
Accelerates or decelerates based on a quadratic curve.
3. **Sinusoidal (`EASE_SINUSOIDAL`):**
Smooth, wave-like transitions.
4. **Cubic (`EASE_CUBIC`):**
Accelerates or decelerates based on a cubic curve.
5. **Exponential (`EASE_EXPONENTIAL`):**
Rapid acceleration or deceleration, creating an exponential curve.
### Preset Types
Presets allow users to quickly apply common configurations without manually setting each parameter.
1. **Default (`PRESET_DEFAULT`):**
- Strength: 50
- Hold Time: 300 ms
- Mouse Speed: 5 ms/step
- Easing Type: Sinusoidal
- Smooth Movement: Enabled
2. **Fast (`PRESET_FAST`):**
- Strength: 80
- Hold Time: 100 ms
- Mouse Speed: 2 ms/step
- Easing Type: Exponential
- Smooth Movement: Disabled
3. **Smooth (`PRESET_SMOOTH`):**
- Strength: 30
- Hold Time: 500 ms
- Mouse Speed: 10 ms/step
- Easing Type: Sinusoidal
- Smooth Movement: Enabled
### Log Levels
Control the verbosity of the library's logging output.
- **None (`LOG_LEVEL_NONE`):**
No logging.
- **Error (`LOG_LEVEL_ERROR`):**
Logs only error messages.
- **Info (`LOG_LEVEL_INFO`):**
Logs informational messages and errors.
- **Debug (`LOG_LEVEL_DEBUG`):**
Logs detailed debug information, including all messages.
---
## How It Works
Mouse Anywhere leverages the Windows API to control mouse actions programmatically. Here's an overview of its internal workings:
1. **Initialization:**
- Opens a log file (`mouse_movement.log`) for recording actions based on the logging level.
- Allocates and initializes global parameters with default or preset configurations.
- Sets up critical sections to ensure thread-safe operations when accessing or modifying global parameters.
2. **Cursor Control:**
- **Absolute Positioning:**
Uses `SetCursorPos` to move the cursor to specified screen coordinates.
- **Smooth Movement:**
Implements smooth transitions by calculating intermediate positions using easing functions and incrementally updating the cursor position with delays (`Sleep`) based on the configured mouse speed.
3. **Mouse Clicks:**
- Simulates mouse button presses and releases using the `SendInput` function.
- Allows configuring the duration for which a mouse button is held down during a click.
4. **Hold and Move:**
- Combines holding a mouse button with cursor movement to perform drag operations.
- Ensures that the cursor movement stays within the screen bounds to prevent errors.
5. **Configuration Management:**
- Provides functions to update configuration parameters dynamically or apply predefined presets.
- Ensures that all configuration changes are thread-safe using critical sections.
6. **Logging:**
- Records actions, errors, and debug information to `mouse_movement.log` based on the set logging level.
- Includes timestamps for each log entry for better traceability.
7. **Shutdown:**
- Cleans up resources by deleting critical sections, freeing allocated memory, and closing the log file.
---
## Logging
Mouse Anywhere provides a robust logging system to help you monitor its operations and debug issues effectively.
### Log File
All log entries are written to `mouse_movement.log` located in the application's directory.
### Log Levels
You can control the verbosity of the logs by setting the desired log level:
- **None (`LOG_LEVEL_NONE`):**
No logs will be recorded.
- **Error (`LOG_LEVEL_ERROR`):**
Only error messages are logged. Useful for identifying issues without the noise of informational messages.
- **Info (`LOG_LEVEL_INFO`):**
Logs general information about actions performed by the library, including successful operations and errors.
- **Debug (`LOG_LEVEL_DEBUG`):**
Provides detailed logs, including debug information. Ideal for development and troubleshooting.
### Setting the Log Level
You can set the log level using the `set_logging_level` function.
```c
// C Example
set_logging_level(LOG_LEVEL_DEBUG);
```
```python
# Python Example
mouse.set_logging_level(3) # Debug level
```
### Log Entry Format
Each log entry follows the format:
```
[YYYY-MM-DD HH:MM:SS] [LOG_LEVEL] Message
```
**Example:**
```
[2024-04-27 14:35:22] [2] Mouse click performed.
[2024-04-27 14:35:25] [3] Mouse teleported to absolute position.
```
---
## Error Handling
Mouse Anywhere includes basic error handling to ensure robust operation:
- **Invalid Parameters:**
Functions validate input parameters and log errors if invalid values are provided. For example, attempting to click an unsupported mouse button will result in an error log.
- **Resource Allocation:**
If the library fails to allocate necessary resources (e.g., memory for global parameters), it logs an error message.
- **File Operations:**
If the log file cannot be opened, the library continues to operate but without logging capabilities.
- **Thread Safety:**
Uses critical sections to manage concurrent access, preventing race conditions and ensuring data integrity.
**Best Practices:**
- **Check Log Files:**
Regularly inspect `mouse_movement.log` to monitor the library's actions and identify any potential issues.
- **Validate Inputs:**
Ensure that all input parameters passed to the library functions are within the expected ranges and types to prevent errors.
---
## Contributing
Contributions are welcome! Whether you're reporting a bug, suggesting a feature, or submitting a pull request, your input helps improve Mouse Anywhere.
### How to Contribute
1. **Fork the Repository:**
Click the **Fork** button on the [GitHub repository](https://github.com/wuhplaptop/mouse-anywhere) to create your own copy.
2. **Clone Your Fork:**
```bash
git clone https://github.com/your-username/mouse-anywhere.git
```
3. **Create a Branch:**
```bash
git checkout -b feature/your-feature-name
```
4. **Make Your Changes:**
Implement your changes or additions.
5. **Commit Your Changes:**
```bash
git commit -m "Add your descriptive commit message"
```
6. **Push to Your Fork:**
```bash
git push origin feature/your-feature-name
```
7. **Create a Pull Request:**
Navigate to your fork on GitHub and click **Compare & pull request**. Provide a clear description of your changes.
### Reporting Issues
If you encounter any bugs or have suggestions for improvements, please open an issue on the [GitHub Issues](https://github.com/wuhplaptop/mouse-anywhere/issues) page.
---
## License
Mouse Anywhere is licensed under the [MIT License](LICENSE).
---
## Support
For any questions, issues, or support requests, please visit our [GitHub repository](https://github.com/wuhplaptop/mouse-anywhere/tree/main) and open an issue. We're here to help!
---
## Example Usage
### Python Wrapper Example
Here's a comprehensive example demonstrating how to use the Python wrapper to perform various mouse operations:
```python
import mouse_anywhere as mouse
import time
def main():
# Initialize the library
mouse.initialize()
# Set logging level to Debug
mouse.set_logging_level(3)
# Apply the Smooth preset
mouse.apply_preset(3)
# Move cursor to (500, 500) smoothly
mouse.set_cursor_abs(500, 500)
time.sleep(1)
# Perform a left click
mouse.click(1)
time.sleep(0.5)
# Hold left button and move to (800, 800) over 2 seconds
mouse.hold_and_move(800, 800, 1, 2000)
time.sleep(1)
# Update configuration dynamically
mouse.set_config(strength=70, hold_time_ms=200, mouse_speed=4, easing_type=2, smooth_movement=False)
# Move cursor to (300, 300) without smooth movement
mouse.set_cursor_abs(300, 300)
time.sleep(1)
# Shutdown the library
mouse.mouse_shutdown()
if __name__ == "__main__":
main()
```
**Explanation:**
1. **Initialization:**
- Initializes the Mouse Anywhere library.
2. **Logging:**
- Sets the logging level to Debug for detailed logs.
3. **Preset:**
- Applies the Smooth preset for smoother cursor movements.
4. **Cursor Movement:**
- Moves the cursor to `(500, 500)` smoothly.
5. **Click:**
- Performs a left mouse click.
6. **Hold and Move:**
- Holds the left mouse button and moves the cursor to `(800, 800)` over 2 seconds, simulating a drag operation.
7. **Dynamic Configuration:**
- Updates the configuration to increase strength, reduce hold time, adjust mouse speed, change easing type, and disable smooth movement.
8. **Cursor Movement Without Smoothness:**
- Moves the cursor to `(300, 300)` without smooth transitions based on the updated configuration.
9. **Shutdown:**
- Shuts down the library, ensuring all resources are properly released.
---
## Frequently Asked Questions (FAQ)
### 1. **Can I use Mouse Anywhere on multiple monitors?**
Yes, Mouse Anywhere supports multi-monitor setups. It automatically enforces screen bounds based on the virtual screen dimensions to ensure the cursor stays within available display areas.
### 2. **How do I change the log file location?**
By default, the log file `mouse_movement.log` is created in the application's directory. To change the location, modify the `LOG_FILE` macro in the C source code and rebuild the DLL.
### 3. **What easing function should I use for the smoothest movement?**
The `EASE_SINUSOIDAL` easing type provides smooth, natural transitions that are visually appealing for most use cases.
### 4. **Is the library thread-safe?**
Yes, Mouse Anywhere uses critical sections to manage concurrent access to global parameters, ensuring thread safety.
### 5. **Can I extend the library to support more features?**
Absolutely! The source code is open for customization. Feel free to fork the repository and add new functionalities as needed.
### 6. **Do I need to have administrator privileges to use Mouse Anywhere?**
No, Mouse Anywhere does not require administrator privileges for standard operations. However, certain actions or system configurations might necessitate elevated permissions.
### 7. **How can I troubleshoot issues with Mouse Anywhere?**
Enable detailed logging by setting the log level to Debug (`3`). Check the `mouse_movement.log` file for detailed information about the library's operations and any errors encountered.
### 8. **Is Mouse Anywhere compatible with Python 3.x?**
Yes, Mouse Anywhere is compatible with Python 3.6 and later versions.
### 9. **Can I use Mouse Anywhere in a virtual environment?**
Yes, as long as the virtual environment has access to the necessary DLL files and dependencies, Mouse Anywhere can be used within a Python virtual environment.
### 10. **How do I update Mouse Anywhere to the latest version?**
If installed via `pip`, you can update using:
```bash
pip install --upgrade mouse-anywhere
```
If built manually, pull the latest changes from the repository and rebuild the DLL.
---
## Contact
For more information, support, or to contribute, visit our [GitHub repository](https://github.com/wuhplaptop/mouse-anywhere/tree/main).
Raw data
{
"_id": null,
"home_page": "https://github.com/wuhplaptop/mouse-anywhere",
"name": "mouse-anywhere",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "mouse automation cursor movement DLL",
"author": "wuhp",
"author_email": "wuhp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ac/52/d9d068a67e79e4219dc5db5b697b9afe85e1f9a2bf650a08578f3be43da2/mouse-anywhere-0.2.6.tar.gz",
"platform": null,
"description": "# Mouse Anywhere\r\n\r\nMouse Anywhere is a powerful and flexible DLL library designed to provide advanced mouse control functionalities on Windows platforms. Whether you're developing automation scripts, creating custom user interfaces, or enhancing accessibility features, Mouse Anywhere offers a comprehensive set of tools to manipulate mouse movements and actions with precision and ease.\r\n\r\n## Table of Contents\r\n\r\n- [Features](#features)\r\n- [Installation](#installation)\r\n - [Prerequisites](#prerequisites)\r\n - [Installation via pip](#installation-via-pip)\r\n - [Building the DLL Manually](#building-the-dll-manually)\r\n - [Using the Python Wrapper](#using-the-python-wrapper)\r\n- [Usage](#usage)\r\n - [Initialization and Shutdown](#initialization-and-shutdown)\r\n - [Cursor Control](#cursor-control)\r\n - [Mouse Clicks](#mouse-clicks)\r\n - [Hold and Move](#hold-and-move)\r\n - [Configuration](#configuration)\r\n - [Presets](#presets)\r\n - [Logging](#logging)\r\n- [API Reference](#api-reference)\r\n - [Exported Functions](#exported-functions)\r\n - [Configuration Parameters](#configuration-parameters)\r\n - [Easing Types](#easing-types)\r\n - [Preset Types](#preset-types)\r\n - [Log Levels](#log-levels)\r\n- [How It Works](#how-it-works)\r\n- [Logging](#logging)\r\n- [Error Handling](#error-handling)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n- [Support](#support)\r\n- [Example Usage](#example-usage)\r\n- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq)\r\n- [Contact](#contact)\r\n\r\n---\r\n\r\n## Features\r\n\r\n- **Absolute Cursor Positioning:** Move the mouse cursor to any position on the screen, with optional smooth transitions.\r\n- **Mouse Clicks:** Perform left, right, and middle mouse clicks with configurable hold times.\r\n- **Hold and Move:** Hold down a mouse button while moving the cursor, useful for drag-and-drop operations.\r\n- **Configuration Options:** Customize strength, hold time, mouse speed, easing types, and smooth movement.\r\n- **Presets:** Apply predefined configurations for default, fast, or smooth mouse behavior.\r\n- **Logging:** Detailed logging with configurable log levels to monitor actions and debug issues.\r\n- **Thread-Safe:** Utilizes critical sections to manage concurrent access to global parameters.\r\n\r\n---\r\n\r\n## Installation\r\n\r\nMouse Anywhere can be installed either via `pip` for ease of use or built manually from the source for customization. Choose the method that best fits your needs.\r\n\r\n### Prerequisites\r\n\r\n- **Operating System:** Windows (tested on Windows 10 and later)\r\n- **Development Tools:** Microsoft Visual Studio or any C/C++ compiler supporting Windows DLLs (only if building manually)\r\n- **Python:** Python 3.6 or later (for using the Python wrapper)\r\n- **Dependencies:** None beyond standard C libraries and Python's `ctypes` module\r\n\r\n### Installation via pip\r\n\r\nFor a straightforward installation, you can install Mouse Anywhere directly from PyPI using `pip`. This method is recommended for most users as it simplifies the setup process.\r\n\r\n1. **Install via pip:**\r\n\r\n Open your command prompt or terminal and run:\r\n\r\n ```bash\r\n pip install mouse-anywhere\r\n ```\r\n\r\n2. **Verify Installation:**\r\n\r\n After installation, you can verify by importing the module in Python:\r\n\r\n ```python\r\n import mouse_anywhere as mouse\r\n ```\r\n\r\n3. **Note:**\r\n\r\n The `pip` installation includes the pre-built `mouse_anywhere.dll`. Ensure that your system meets the necessary prerequisites, and you have the appropriate permissions to install Python packages.\r\n\r\n### Building the DLL Manually\r\n\r\nIf you prefer to build the DLL from the source, perhaps to customize functionalities or verify the source code, follow these steps:\r\n\r\n1. **Clone the Repository:**\r\n\r\n ```bash\r\n git clone https://github.com/wuhplaptop/mouse-anywhere.git\r\n ```\r\n\r\n2. **Open the Project:**\r\n\r\n Open the project in your preferred C/C++ development environment. For example, using Visual Studio:\r\n\r\n - Open Visual Studio.\r\n - Select **File > Open > Project/Solution**.\r\n - Navigate to the cloned repository and open the `.sln` file if available, or create a new DLL project and add the provided `mouse_anywhere.c` file.\r\n\r\n3. **Build the DLL:**\r\n\r\n - Configure the build settings as needed (e.g., Release mode).\r\n - Build the project to generate `mouse_anywhere.dll`.\r\n\r\n4. **Locate the DLL:**\r\n\r\n After a successful build, locate the `mouse_anywhere.dll` in the project's output directory (e.g., `Debug` or `Release`).\r\n\r\n### Using the Python Wrapper\r\n\r\nWhether you installed via `pip` or built the DLL manually, you can utilize the Python wrapper to interact with Mouse Anywhere seamlessly.\r\n\r\n1. **Ensure the DLL is Accessible:**\r\n\r\n - **If Installed via pip:** The DLL is included and should be accessible automatically.\r\n - **If Built Manually:** Place the `mouse_anywhere.dll` in the same directory as your Python script or in a directory that's part of your system's PATH.\r\n\r\n2. **Install Python (if not already installed):**\r\n\r\n Download and install Python from the [official website](https://www.python.org/downloads/).\r\n\r\n3. **Using the Wrapper:**\r\n\r\n Here's a basic example of how to use the Python wrapper:\r\n\r\n ```python\r\n import mouse_anywhere as mouse\r\n\r\n # Initialize the library\r\n mouse.initialize()\r\n\r\n # Set cursor to position (500, 500)\r\n mouse.set_cursor_abs(500, 500)\r\n\r\n # Perform a left click\r\n mouse.click(1)\r\n\r\n # Shutdown the library\r\n mouse.mouse_shutdown()\r\n ```\r\n\r\n Replace `mouse_anywhere` with the actual name of your Python wrapper file if different.\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### Initialization and Shutdown\r\n\r\nBefore performing any mouse operations, initialize the library. After completing your tasks, ensure you properly shut down the library to release resources.\r\n\r\n#### C Example\r\n\r\n```c\r\n#include \"mouse_anywhere.h\"\r\n\r\nint main() {\r\n initialize();\r\n\r\n // Perform mouse operations here\r\n\r\n mouse_shutdown();\r\n return 0;\r\n}\r\n```\r\n\r\n#### Python Example\r\n\r\n```python\r\nimport mouse_anywhere as mouse\r\n\r\nmouse.initialize()\r\n\r\n# Perform mouse operations here\r\n\r\nmouse.mouse_shutdown()\r\n```\r\n\r\n### Cursor Control\r\n\r\n#### Set Cursor to Absolute Position\r\n\r\nMove the cursor to a specific (x, y) coordinate on the screen.\r\n\r\n##### C Example\r\n\r\n```c\r\nset_cursor_abs(1000, 500);\r\n```\r\n\r\n##### Python Example\r\n\r\n```python\r\nmouse.set_cursor_abs(1000, 500)\r\n```\r\n\r\n#### Smooth Movement\r\n\r\nEnable or disable smooth cursor transitions by configuring the `smooth_movement` parameter.\r\n\r\n### Mouse Clicks\r\n\r\n#### Perform a Click\r\n\r\nSimulate a mouse button click. Supported buttons are:\r\n\r\n- `1` - Left Click\r\n- `2` - Right Click\r\n- `3` - Middle Click\r\n\r\n##### C Example\r\n\r\n```c\r\nclick(1); // Left Click\r\n```\r\n\r\n##### Python Example\r\n\r\n```python\r\nmouse.click(1) # Left Click\r\n```\r\n\r\n#### Configurable Hold Time\r\n\r\nSet how long the mouse button is held down during a click.\r\n\r\n```c\r\n// C Example\r\nset_config(50, 300, 5, EASE_LINEAR, true); // strength, hold_time_ms, mouse_speed, easing_type, smooth_movement\r\n```\r\n\r\n### Hold and Move\r\n\r\nHold down a mouse button while moving the cursor to perform drag operations.\r\n\r\n##### C Example\r\n\r\n```c\r\nhold_and_move(1500, 1000, 1, 2000); // x, y, button, duration_ms\r\n```\r\n\r\n##### Python Example\r\n\r\n```python\r\nmouse.hold_and_move(1500, 1000, 1, 2000) # x, y, button, duration_ms\r\n```\r\n\r\n### Configuration\r\n\r\nCustomize the mouse behavior by setting configuration parameters:\r\n\r\n- **Strength:** Determines the number of steps in movement. Range: `1` to `100`.\r\n- **Hold Time (ms):** Duration to hold mouse clicks.\r\n- **Mouse Speed (ms per step):** Speed of cursor movement.\r\n- **Easing Type:** Type of easing function for smooth transitions.\r\n- **Smooth Movement:** Enable or disable smooth cursor movement.\r\n\r\n##### C Example\r\n\r\n```c\r\nset_config(70, 200, 3, EASE_QUADRATIC, false);\r\n```\r\n\r\n##### Python Example\r\n\r\n```python\r\nmouse.set_config(70, 200, 3, 2, False) # strength, hold_time_ms, mouse_speed, easing_type, smooth_movement\r\n```\r\n\r\n### Presets\r\n\r\nApply predefined configurations for common use cases:\r\n\r\n- `1` - Default\r\n- `2` - Fast\r\n- `3` - Smooth\r\n\r\n##### C Example\r\n\r\n```c\r\napply_preset(PRESET_FAST);\r\n```\r\n\r\n##### Python Example\r\n\r\n```python\r\nmouse.apply_preset(2) # Fast preset\r\n```\r\n\r\n### Logging\r\n\r\nEnable and configure logging to monitor actions and debug issues. Set the logging level:\r\n\r\n- `0` - None\r\n- `1` - Error\r\n- `2` - Info\r\n- `3` - Debug\r\n\r\n##### C Example\r\n\r\n```c\r\nset_logging_level(LOG_LEVEL_DEBUG);\r\n```\r\n\r\n##### Python Example\r\n\r\n```python\r\nmouse.set_logging_level(3) # Debug level\r\n```\r\n\r\nLogs are written to `mouse_movement.log` in the application's directory.\r\n\r\n---\r\n\r\n## API Reference\r\n\r\n### Exported Functions\r\n\r\n#### `initialize()`\r\n\r\n**Description:** \r\nInitializes the Mouse Anywhere library. Must be called before any other functions.\r\n\r\n**Usage:**\r\n\r\n```c\r\ninitialize();\r\n```\r\n\r\n```python\r\nmouse.initialize()\r\n```\r\n\r\n#### `mouse_shutdown()`\r\n\r\n**Description:** \r\nShuts down the Mouse Anywhere library and releases resources.\r\n\r\n**Usage:**\r\n\r\n```c\r\nmouse_shutdown();\r\n```\r\n\r\n```python\r\nmouse.mouse_shutdown()\r\n```\r\n\r\n#### `set_cursor_abs(int x, int y)`\r\n\r\n**Description:** \r\nMoves the cursor to the specified absolute (x, y) screen coordinates.\r\n\r\n**Parameters:**\r\n\r\n- `x` (`int`): The x-coordinate on the screen.\r\n- `y` (`int`): The y-coordinate on the screen.\r\n\r\n**Usage:**\r\n\r\n```c\r\nset_cursor_abs(800, 600);\r\n```\r\n\r\n```python\r\nmouse.set_cursor_abs(800, 600)\r\n```\r\n\r\n#### `click(int button)`\r\n\r\n**Description:** \r\nPerforms a mouse button click.\r\n\r\n**Parameters:**\r\n\r\n- `button` (`int`): The mouse button to click.\r\n - `1` - Left Click\r\n - `2` - Right Click\r\n - `3` - Middle Click\r\n\r\n**Usage:**\r\n\r\n```c\r\nclick(1); // Left Click\r\n```\r\n\r\n```python\r\nmouse.click(1) # Left Click\r\n```\r\n\r\n#### `hold_and_move(int x, int y, int button, int duration_ms)`\r\n\r\n**Description:** \r\nHolds down a specified mouse button and moves the cursor to the target (x, y) position over the specified duration.\r\n\r\n**Parameters:**\r\n\r\n- `x` (`int`): The target x-coordinate.\r\n- `y` (`int`): The target y-coordinate.\r\n- `button` (`int`): The mouse button to hold.\r\n - `1` - Left Click\r\n - `2` - Right Click\r\n - `3` - Middle Click\r\n- `duration_ms` (`int`): Duration in milliseconds for the movement.\r\n\r\n**Usage:**\r\n\r\n```c\r\nhold_and_move(1200, 800, 1, 1500); // Hold left button and move\r\n```\r\n\r\n```python\r\nmouse.hold_and_move(1200, 800, 1, 1500) # Hold left button and move\r\n```\r\n\r\n#### `set_mouse_speed(int speed)`\r\n\r\n**Description:** \r\nSets the speed of mouse movement in milliseconds per step.\r\n\r\n**Parameters:**\r\n\r\n- `speed` (`int`): Mouse speed. Must be greater than `0`.\r\n\r\n**Usage:**\r\n\r\n```c\r\nset_mouse_speed(10);\r\n```\r\n\r\n```python\r\nmouse.set_mouse_speed(10)\r\n```\r\n\r\n#### `set_config(int strength, int hold_time_ms, int mouse_speed, int easing_type, bool smooth_movement)`\r\n\r\n**Description:** \r\nConfigures the mouse behavior with custom settings.\r\n\r\n**Parameters:**\r\n\r\n- `strength` (`int`): Movement strength (1-100).\r\n- `hold_time_ms` (`int`): Hold time for clicks in milliseconds.\r\n- `mouse_speed` (`int`): Speed of mouse movement in ms per step.\r\n- `easing_type` (`int`): Type of easing function.\r\n - `1` - Linear\r\n - `2` - Quadratic\r\n - `3` - Sinusoidal\r\n - `4` - Cubic\r\n - `5` - Exponential\r\n- `smooth_movement` (`bool`): Enable (`true`) or disable (`false`) smooth movement.\r\n\r\n**Usage:**\r\n\r\n```c\r\nset_config(60, 250, 5, 3, true);\r\n```\r\n\r\n```python\r\nmouse.set_config(60, 250, 5, 3, True)\r\n```\r\n\r\n#### `apply_preset(int preset_type)`\r\n\r\n**Description:** \r\nApplies a preset configuration.\r\n\r\n**Parameters:**\r\n\r\n- `preset_type` (`int`):\r\n - `1` - Default\r\n - `2` - Fast\r\n - `3` - Smooth\r\n\r\n**Usage:**\r\n\r\n```c\r\napply_preset(3); // Apply Smooth preset\r\n```\r\n\r\n```python\r\nmouse.apply_preset(3) # Apply Smooth preset\r\n```\r\n\r\n#### `set_logging_level(int level)`\r\n\r\n**Description:** \r\nSets the logging level for the library.\r\n\r\n**Parameters:**\r\n\r\n- `level` (`int`):\r\n - `0` - None\r\n - `1` - Error\r\n - `2` - Info\r\n - `3` - Debug\r\n\r\n**Usage:**\r\n\r\n```c\r\nset_logging_level(2); // Set to Info level\r\n```\r\n\r\n```python\r\nmouse.set_logging_level(2) # Set to Info level\r\n```\r\n\r\n### Configuration Parameters\r\n\r\n- **Strength (`strength`):** \r\n Determines the number of steps in mouse movement. Higher values result in smoother and longer transitions.\r\n\r\n- **Hold Time (`hold_time_ms`):** \r\n Duration in milliseconds to hold a mouse button down during a click.\r\n\r\n- **Mouse Speed (`mouse_speed`):** \r\n Speed of mouse movement in milliseconds per step. Lower values result in faster movement.\r\n\r\n- **Easing Type (`easing_type`):** \r\n Defines the easing function for smooth cursor transitions. Available types:\r\n \r\n | Value | Type |\r\n |-------|---------------|\r\n | 1 | Linear |\r\n | 2 | Quadratic |\r\n | 3 | Sinusoidal |\r\n | 4 | Cubic |\r\n | 5 | Exponential |\r\n\r\n- **Smooth Movement (`smooth_movement`):** \r\n Enables (`true`) or disables (`false`) smooth cursor movement.\r\n\r\n### Easing Types\r\n\r\nEasing functions control the acceleration and deceleration of cursor movements. They provide more natural and visually appealing transitions.\r\n\r\n1. **Linear (`EASE_LINEAR`):** \r\n Constant speed from start to finish.\r\n\r\n2. **Quadratic (`EASE_QUADRATIC`):** \r\n Accelerates or decelerates based on a quadratic curve.\r\n\r\n3. **Sinusoidal (`EASE_SINUSOIDAL`):** \r\n Smooth, wave-like transitions.\r\n\r\n4. **Cubic (`EASE_CUBIC`):** \r\n Accelerates or decelerates based on a cubic curve.\r\n\r\n5. **Exponential (`EASE_EXPONENTIAL`):** \r\n Rapid acceleration or deceleration, creating an exponential curve.\r\n\r\n### Preset Types\r\n\r\nPresets allow users to quickly apply common configurations without manually setting each parameter.\r\n\r\n1. **Default (`PRESET_DEFAULT`):** \r\n - Strength: 50 \r\n - Hold Time: 300 ms \r\n - Mouse Speed: 5 ms/step \r\n - Easing Type: Sinusoidal \r\n - Smooth Movement: Enabled\r\n\r\n2. **Fast (`PRESET_FAST`):** \r\n - Strength: 80 \r\n - Hold Time: 100 ms \r\n - Mouse Speed: 2 ms/step \r\n - Easing Type: Exponential \r\n - Smooth Movement: Disabled\r\n\r\n3. **Smooth (`PRESET_SMOOTH`):** \r\n - Strength: 30 \r\n - Hold Time: 500 ms \r\n - Mouse Speed: 10 ms/step \r\n - Easing Type: Sinusoidal \r\n - Smooth Movement: Enabled\r\n\r\n### Log Levels\r\n\r\nControl the verbosity of the library's logging output.\r\n\r\n- **None (`LOG_LEVEL_NONE`):** \r\n No logging.\r\n\r\n- **Error (`LOG_LEVEL_ERROR`):** \r\n Logs only error messages.\r\n\r\n- **Info (`LOG_LEVEL_INFO`):** \r\n Logs informational messages and errors.\r\n\r\n- **Debug (`LOG_LEVEL_DEBUG`):** \r\n Logs detailed debug information, including all messages.\r\n\r\n---\r\n\r\n## How It Works\r\n\r\nMouse Anywhere leverages the Windows API to control mouse actions programmatically. Here's an overview of its internal workings:\r\n\r\n1. **Initialization:**\r\n - Opens a log file (`mouse_movement.log`) for recording actions based on the logging level.\r\n - Allocates and initializes global parameters with default or preset configurations.\r\n - Sets up critical sections to ensure thread-safe operations when accessing or modifying global parameters.\r\n\r\n2. **Cursor Control:**\r\n - **Absolute Positioning:** \r\n Uses `SetCursorPos` to move the cursor to specified screen coordinates.\r\n - **Smooth Movement:** \r\n Implements smooth transitions by calculating intermediate positions using easing functions and incrementally updating the cursor position with delays (`Sleep`) based on the configured mouse speed.\r\n\r\n3. **Mouse Clicks:**\r\n - Simulates mouse button presses and releases using the `SendInput` function.\r\n - Allows configuring the duration for which a mouse button is held down during a click.\r\n\r\n4. **Hold and Move:**\r\n - Combines holding a mouse button with cursor movement to perform drag operations.\r\n - Ensures that the cursor movement stays within the screen bounds to prevent errors.\r\n\r\n5. **Configuration Management:**\r\n - Provides functions to update configuration parameters dynamically or apply predefined presets.\r\n - Ensures that all configuration changes are thread-safe using critical sections.\r\n\r\n6. **Logging:**\r\n - Records actions, errors, and debug information to `mouse_movement.log` based on the set logging level.\r\n - Includes timestamps for each log entry for better traceability.\r\n\r\n7. **Shutdown:**\r\n - Cleans up resources by deleting critical sections, freeing allocated memory, and closing the log file.\r\n\r\n---\r\n\r\n## Logging\r\n\r\nMouse Anywhere provides a robust logging system to help you monitor its operations and debug issues effectively.\r\n\r\n### Log File\r\n\r\nAll log entries are written to `mouse_movement.log` located in the application's directory.\r\n\r\n### Log Levels\r\n\r\nYou can control the verbosity of the logs by setting the desired log level:\r\n\r\n- **None (`LOG_LEVEL_NONE`):** \r\n No logs will be recorded.\r\n\r\n- **Error (`LOG_LEVEL_ERROR`):** \r\n Only error messages are logged. Useful for identifying issues without the noise of informational messages.\r\n\r\n- **Info (`LOG_LEVEL_INFO`):** \r\n Logs general information about actions performed by the library, including successful operations and errors.\r\n\r\n- **Debug (`LOG_LEVEL_DEBUG`):** \r\n Provides detailed logs, including debug information. Ideal for development and troubleshooting.\r\n\r\n### Setting the Log Level\r\n\r\nYou can set the log level using the `set_logging_level` function.\r\n\r\n```c\r\n// C Example\r\nset_logging_level(LOG_LEVEL_DEBUG);\r\n```\r\n\r\n```python\r\n# Python Example\r\nmouse.set_logging_level(3) # Debug level\r\n```\r\n\r\n### Log Entry Format\r\n\r\nEach log entry follows the format:\r\n\r\n```\r\n[YYYY-MM-DD HH:MM:SS] [LOG_LEVEL] Message\r\n```\r\n\r\n**Example:**\r\n\r\n```\r\n[2024-04-27 14:35:22] [2] Mouse click performed.\r\n[2024-04-27 14:35:25] [3] Mouse teleported to absolute position.\r\n```\r\n\r\n---\r\n\r\n## Error Handling\r\n\r\nMouse Anywhere includes basic error handling to ensure robust operation:\r\n\r\n- **Invalid Parameters:** \r\n Functions validate input parameters and log errors if invalid values are provided. For example, attempting to click an unsupported mouse button will result in an error log.\r\n\r\n- **Resource Allocation:** \r\n If the library fails to allocate necessary resources (e.g., memory for global parameters), it logs an error message.\r\n\r\n- **File Operations:** \r\n If the log file cannot be opened, the library continues to operate but without logging capabilities.\r\n\r\n- **Thread Safety:** \r\n Uses critical sections to manage concurrent access, preventing race conditions and ensuring data integrity.\r\n\r\n**Best Practices:**\r\n\r\n- **Check Log Files:** \r\n Regularly inspect `mouse_movement.log` to monitor the library's actions and identify any potential issues.\r\n\r\n- **Validate Inputs:** \r\n Ensure that all input parameters passed to the library functions are within the expected ranges and types to prevent errors.\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Whether you're reporting a bug, suggesting a feature, or submitting a pull request, your input helps improve Mouse Anywhere.\r\n\r\n### How to Contribute\r\n\r\n1. **Fork the Repository:**\r\n\r\n Click the **Fork** button on the [GitHub repository](https://github.com/wuhplaptop/mouse-anywhere) to create your own copy.\r\n\r\n2. **Clone Your Fork:**\r\n\r\n ```bash\r\n git clone https://github.com/your-username/mouse-anywhere.git\r\n ```\r\n\r\n3. **Create a Branch:**\r\n\r\n ```bash\r\n git checkout -b feature/your-feature-name\r\n ```\r\n\r\n4. **Make Your Changes:**\r\n\r\n Implement your changes or additions.\r\n\r\n5. **Commit Your Changes:**\r\n\r\n ```bash\r\n git commit -m \"Add your descriptive commit message\"\r\n ```\r\n\r\n6. **Push to Your Fork:**\r\n\r\n ```bash\r\n git push origin feature/your-feature-name\r\n ```\r\n\r\n7. **Create a Pull Request:**\r\n\r\n Navigate to your fork on GitHub and click **Compare & pull request**. Provide a clear description of your changes.\r\n\r\n### Reporting Issues\r\n\r\nIf you encounter any bugs or have suggestions for improvements, please open an issue on the [GitHub Issues](https://github.com/wuhplaptop/mouse-anywhere/issues) page.\r\n\r\n---\r\n\r\n## License\r\n\r\nMouse Anywhere is licensed under the [MIT License](LICENSE).\r\n\r\n---\r\n\r\n## Support\r\n\r\nFor any questions, issues, or support requests, please visit our [GitHub repository](https://github.com/wuhplaptop/mouse-anywhere/tree/main) and open an issue. We're here to help!\r\n\r\n---\r\n\r\n## Example Usage\r\n\r\n### Python Wrapper Example\r\n\r\nHere's a comprehensive example demonstrating how to use the Python wrapper to perform various mouse operations:\r\n\r\n```python\r\nimport mouse_anywhere as mouse\r\nimport time\r\n\r\ndef main():\r\n # Initialize the library\r\n mouse.initialize()\r\n\r\n # Set logging level to Debug\r\n mouse.set_logging_level(3)\r\n\r\n # Apply the Smooth preset\r\n mouse.apply_preset(3)\r\n\r\n # Move cursor to (500, 500) smoothly\r\n mouse.set_cursor_abs(500, 500)\r\n time.sleep(1)\r\n\r\n # Perform a left click\r\n mouse.click(1)\r\n time.sleep(0.5)\r\n\r\n # Hold left button and move to (800, 800) over 2 seconds\r\n mouse.hold_and_move(800, 800, 1, 2000)\r\n time.sleep(1)\r\n\r\n # Update configuration dynamically\r\n mouse.set_config(strength=70, hold_time_ms=200, mouse_speed=4, easing_type=2, smooth_movement=False)\r\n\r\n # Move cursor to (300, 300) without smooth movement\r\n mouse.set_cursor_abs(300, 300)\r\n time.sleep(1)\r\n\r\n # Shutdown the library\r\n mouse.mouse_shutdown()\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n\r\n**Explanation:**\r\n\r\n1. **Initialization:**\r\n - Initializes the Mouse Anywhere library.\r\n\r\n2. **Logging:**\r\n - Sets the logging level to Debug for detailed logs.\r\n\r\n3. **Preset:**\r\n - Applies the Smooth preset for smoother cursor movements.\r\n\r\n4. **Cursor Movement:**\r\n - Moves the cursor to `(500, 500)` smoothly.\r\n\r\n5. **Click:**\r\n - Performs a left mouse click.\r\n\r\n6. **Hold and Move:**\r\n - Holds the left mouse button and moves the cursor to `(800, 800)` over 2 seconds, simulating a drag operation.\r\n\r\n7. **Dynamic Configuration:**\r\n - Updates the configuration to increase strength, reduce hold time, adjust mouse speed, change easing type, and disable smooth movement.\r\n\r\n8. **Cursor Movement Without Smoothness:**\r\n - Moves the cursor to `(300, 300)` without smooth transitions based on the updated configuration.\r\n\r\n9. **Shutdown:**\r\n - Shuts down the library, ensuring all resources are properly released.\r\n\r\n---\r\n\r\n## Frequently Asked Questions (FAQ)\r\n\r\n### 1. **Can I use Mouse Anywhere on multiple monitors?**\r\n\r\nYes, Mouse Anywhere supports multi-monitor setups. It automatically enforces screen bounds based on the virtual screen dimensions to ensure the cursor stays within available display areas.\r\n\r\n### 2. **How do I change the log file location?**\r\n\r\nBy default, the log file `mouse_movement.log` is created in the application's directory. To change the location, modify the `LOG_FILE` macro in the C source code and rebuild the DLL.\r\n\r\n### 3. **What easing function should I use for the smoothest movement?**\r\n\r\nThe `EASE_SINUSOIDAL` easing type provides smooth, natural transitions that are visually appealing for most use cases.\r\n\r\n### 4. **Is the library thread-safe?**\r\n\r\nYes, Mouse Anywhere uses critical sections to manage concurrent access to global parameters, ensuring thread safety.\r\n\r\n### 5. **Can I extend the library to support more features?**\r\n\r\nAbsolutely! The source code is open for customization. Feel free to fork the repository and add new functionalities as needed.\r\n\r\n### 6. **Do I need to have administrator privileges to use Mouse Anywhere?**\r\n\r\nNo, Mouse Anywhere does not require administrator privileges for standard operations. However, certain actions or system configurations might necessitate elevated permissions.\r\n\r\n### 7. **How can I troubleshoot issues with Mouse Anywhere?**\r\n\r\nEnable detailed logging by setting the log level to Debug (`3`). Check the `mouse_movement.log` file for detailed information about the library's operations and any errors encountered.\r\n\r\n### 8. **Is Mouse Anywhere compatible with Python 3.x?**\r\n\r\nYes, Mouse Anywhere is compatible with Python 3.6 and later versions.\r\n\r\n### 9. **Can I use Mouse Anywhere in a virtual environment?**\r\n\r\nYes, as long as the virtual environment has access to the necessary DLL files and dependencies, Mouse Anywhere can be used within a Python virtual environment.\r\n\r\n### 10. **How do I update Mouse Anywhere to the latest version?**\r\n\r\nIf installed via `pip`, you can update using:\r\n\r\n```bash\r\npip install --upgrade mouse-anywhere\r\n```\r\n\r\nIf built manually, pull the latest changes from the repository and rebuild the DLL.\r\n\r\n---\r\n\r\n## Contact\r\n\r\nFor more information, support, or to contribute, visit our [GitHub repository](https://github.com/wuhplaptop/mouse-anywhere/tree/main).\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for smooth mouse movement using a C library.",
"version": "0.2.6",
"project_urls": {
"Bug Reports": "https://github.com/wuhplaptop/mouse-anywhere/issues",
"Documentation": "https://github.com/wuhplaptop/mouse-anywhere/wiki",
"Homepage": "https://github.com/wuhplaptop/mouse-anywhere",
"Source": "https://github.com/wuhplaptop/mouse-anywhere"
},
"split_keywords": [
"mouse",
"automation",
"cursor",
"movement",
"dll"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1b3fe29710469b32c19892340bb33eee7aeda02426e9d92cf242b9712dc242c6",
"md5": "2aa2ff27976374da441345eade6cb69f",
"sha256": "c4f0e42891e90a60bb3ba6e66b94d97a4b5e027557e738c5ebc79e446e782036"
},
"downloads": -1,
"filename": "mouse_anywhere-0.2.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2aa2ff27976374da441345eade6cb69f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 113948,
"upload_time": "2024-12-26T03:44:21",
"upload_time_iso_8601": "2024-12-26T03:44:21.878770Z",
"url": "https://files.pythonhosted.org/packages/1b/3f/e29710469b32c19892340bb33eee7aeda02426e9d92cf242b9712dc242c6/mouse_anywhere-0.2.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ac52d9d068a67e79e4219dc5db5b697b9afe85e1f9a2bf650a08578f3be43da2",
"md5": "f7805ac31a70ab30b647409be804117d",
"sha256": "c12886462d95b8006fd76b9d6bf9955e9ed219773070148a98c213be966510b3"
},
"downloads": -1,
"filename": "mouse-anywhere-0.2.6.tar.gz",
"has_sig": false,
"md5_digest": "f7805ac31a70ab30b647409be804117d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 123161,
"upload_time": "2024-12-26T03:44:23",
"upload_time_iso_8601": "2024-12-26T03:44:23.278551Z",
"url": "https://files.pythonhosted.org/packages/ac/52/d9d068a67e79e4219dc5db5b697b9afe85e1f9a2bf650a08578f3be43da2/mouse-anywhere-0.2.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-26 03:44:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wuhplaptop",
"github_project": "mouse-anywhere",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mouse-anywhere"
}