This endpoint performs a double-click operation at the specified X and Y coordinates on the screen. The operation is performed using the left mouse button. Double-clicking is particularly useful for operations like opening files and folders, selecting words, and other actions that traditionally require a double-click.
{ "x": number, // X coordinate on the screen "y": number // Y coordinate on the screen }
Parameter | Type | Required | Description |
---|---|---|---|
x | number | Yes | The X coordinate on the screen where the double-click should be performed |
y | number | Yes | The Y coordinate on the screen where the double-click should be performed |
{ "Success": boolean, // Whether the operation was successful "Message": "string", // Result message or error description "Timestamp": "string" // ISO timestamp of the operation }
Field | Type | Description |
---|---|---|
Success | boolean | Indicates whether the double-click operation was successful |
Message | string | A description of the outcome or any error that occurred |
Timestamp | string | The timestamp when the operation was performed (ISO format) |
import requests import json def mouse_double_click(x, y, api_key): """ Perform a double click at the specified coordinates. Args: x (int): The X coordinate. y (int): The Y coordinate. api_key (str): Your API key for authentication. Returns: dict: The response from the server. """ url = "http://localhost:54321/tools-api/mouse/doubleclick" headers = { "Content-Type": "application/json", "Authorization": f"Bearer {api_key}" } data = { "x": x, "y": y } response = requests.post(url, headers=headers, json=data) return response.json() # Example usage if __name__ == "__main__": API_KEY = "your_api_key_here" result = mouse_double_click(500, 300, API_KEY) print(json.dumps(result, indent=2))
interface MouseDoubleClickRequest { x: number; y: number; } interface ActionResponse { success: boolean; message: string; timestamp: string; } /** * Performs a double click at the specified coordinates * @param x The X coordinate * @param y The Y coordinate * @param apiKey Your API key for authentication * @returns A promise that resolves to the action response */ async function mouseDoubleClick( x: number, y: number, apiKey: string ): Promise{ const url = 'http://localhost:54321/tools-api/mouse/doubleclick'; const headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${apiKey}` }; const data: MouseDoubleClickRequest = { x, y }; const response = await fetch(url, { method: 'POST', headers, body: JSON.stringify(data) }); return response.json(); } // Example usage async function example() { const API_KEY = 'your_api_key_here'; try { const result = await mouseDoubleClick(500, 300, API_KEY); console.log(result); } catch (error) { console.error('Error performing double click:', error); } }
using System; using System.Net.Http; using System.Text; using System.Text.Json; using System.Threading.Tasks; public class MouseActionRequest { public int X { get; set; } public int Y { get; set; } } public class ActionResponse { public bool Success { get; set; } public string Message { get; set; } public DateTime Timestamp { get; set; } } public class ToolsServerClient { private readonly HttpClient _httpClient; private readonly string _baseUrl; private readonly string _apiKey; public ToolsServerClient(string baseUrl, string apiKey) { _baseUrl = baseUrl; _apiKey = apiKey; _httpClient = new HttpClient(); _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}"); } public async TaskMouseDoubleClickAsync(int x, int y) { var request = new MouseActionRequest { X = x, Y = y }; return await SendRequestAsync ("/tools-api/mouse/doubleclick", request); } private async Task SendRequestAsync (string endpoint, TRequest requestData) { var json = JsonSerializer.Serialize(requestData, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await _httpClient.PostAsync($"{_baseUrl}{endpoint}", content); response.EnsureSuccessStatusCode(); var responseJson = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize (responseJson, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); } } // Example usage class Program { static async Task Main() { var client = new ToolsServerClient("http://localhost:54321", "your_api_key_here"); try { var result = await client.MouseDoubleClickAsync(500, 300); Console.WriteLine($"Success: {result.Success}"); Console.WriteLine($"Message: {result.Message}"); Console.WriteLine($"Timestamp: {result.Timestamp}"); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } } }
This example demonstrates double-clicking on a file located at coordinates (500, 300) to open it:
{
"x": 500,
"y": 300
}
{
"Success": true,
"Message": "Mouse doubleclick executed at coordinates (500, 300)",
"Timestamp": "2023-10-25T14:30:45.123Z"
}
This example demonstrates double-clicking in a text editor at coordinates (800, 400) to select a word:
{
"x": 800,
"y": 400
}
{
"Success": true,
"Message": "Mouse doubleclick executed at coordinates (800, 400)",
"Timestamp": "2023-10-25T14:32:15.456Z"
}