Moving the Mouse to the Center of the Screen
Translating the mouse to the center of the screen using a script in C#.
You can import the ready-made example from here: https://eu.eyeauras.net/share/S202402240046520BBKcR6QKL07
- Create an aura.
- Add
HotkeyIsActiveto it and bind it to a convenient button (this will be our on/off switch, for exampleF3), change the activation type toClick/Hold. - Add a
C# Scriptaction toOn Enter. - Copy and paste the script itself.
- When you press
F3, the cursor will move to the center of the primary screen.
var sendInputApi = GetService<ISendInputUnstableScriptingApi>(); // needed for input sending
var screenSize = System.Windows.Forms.SystemInformation.PrimaryMonitorSize; // get the size of the primary screen
Log.Info($"Primary monitor size: {screenSize}");
sendInputApi.MouseMoveTo(screenSize.Width / 2, screenSize.Height / 2); // move to the center