Skip to content

A library used to control your mouse and keyboard programmatically in .NET Core

License

Notifications You must be signed in to change notification settings

lucassklp/Desktop.Robot

Folders and files

NameName
Last commit message
Last commit date
Aug 19, 2024
Jul 9, 2023
Jun 11, 2024
Aug 19, 2024
Jul 3, 2023
Dec 19, 2021
Jun 27, 2023
Jan 25, 2021
Oct 17, 2021
Jan 30, 2021
Jul 10, 2023
Jan 30, 2021
Aug 24, 2021
Aug 24, 2021

Repository files navigation

nuget nuget version

Desktop.Robot

This library helps you to automate tasks by simulating inputs (mouse and keyboards) programmatically, inspired in java.awt.Robot

I made this library because the dotnet SDK doesn't support simulation of mouse and keyboard input. The only way of input simulation in the standard framework is by using Windows.Forms which won't run on Linux or OSX.

Installation

If you are using Package Manager:

Install-Package Desktop.Robot -Version 1.5.0

If you are using .NET CLI

dotnet add package Desktop.Robot --version 1.5.0

Advantages

  • Multiplatform: works on Windows, Linux and OSX
  • Built using the Operating System Native and .NET API, other dependencies needed
  • Easy to use

Example of use

using Desktop.Robot;
using Desktop.Robot.Extensions;
namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            var robot = new Robot();
            robot.AutoDelay = 1000;
            robot.MouseMove(100, 100);
            robot.Click();
            robot.Type("A invisible cat is using my PC");
        }
    }
}

Remarks

In order to use the method CreateScreenCapture you will need to install some libraries. This is required by System.Drawing's components

Installing the requirements on Linux

sudo apt install libgdiplus

Current limitations

  1. As we are currently developing this tool, multiple monitors are not supported for now.
  2. The library is under development, and some methods will throw a NotImplementedException