Poss.Win.Automation.Input
1.0.5
dotnet add package Poss.Win.Automation.Input --version 1.0.5
NuGet\Install-Package Poss.Win.Automation.Input -Version 1.0.5
<PackageReference Include="Poss.Win.Automation.Input" Version="1.0.5" />
<PackageVersion Include="Poss.Win.Automation.Input" Version="1.0.5" />
<PackageReference Include="Poss.Win.Automation.Input" />
paket add Poss.Win.Automation.Input --version 1.0.5
#r "nuget: Poss.Win.Automation.Input, 1.0.5"
#:package Poss.Win.Automation.Input@1.0.5
#addin nuget:?package=Poss.Win.Automation.Input&version=1.0.5
#tool nuget:?package=Poss.Win.Automation.Input&version=1.0.5
Poss.Win.Automation.Input
Keyboard and mouse input simulation for Windows: key presses, clicks, cursor movement, Unicode text, window activation, and related utilities. Part of the Poss.Win.Automation family. Targets .NET Standard 2.0.
Use this package when you only need input simulation (no global hotkeys). If you need both input and hotkeys, use the umbrella package Poss.Win.Automation.
Installation
dotnet add package Poss.Win.Automation.Input
Quick Start (no filter)
Input is sent to whichever window is currently focused.
using Poss.Win.Automation.Input;
var sim = new InputSimulator();
sim.SendText("Hello, World!");
sim.Click(100, 200, "LButton");
sim.Send("Ctrl down");
sim.Send("A");
sim.Send("Ctrl up");
Window / process binding
You can bind the simulator to one or more process names or window title substrings. When bound, all input is simulated only when the foreground window matches any of the filters; otherwise calls like SendText, Click, Send are no-ops. Use this to avoid sending keystrokes to the wrong app.
Multiple filters (params)
Pass several process names or title substrings; input is allowed when the foreground matches any of them. Use the Filters property to read the current filter collection.
// Allow input when Notepad, Chrome, or a window titled "Visual Studio" is focused
var sim = new InputSimulator("notepad", "chrome", "Visual Studio");
sim.SendText("Sent to any of the above");
// Inspect the parsed filters
foreach (var f in sim.Filters)
Console.WriteLine($"{f.Type}: {f.Name}");
Bind by process name
Use the process name with or without .exe. Matching is case-sensitive (to avoid accidental matches with similarly named processes).
// Notepad — process name only
var sim = new InputSimulator("notepad");
sim.SendText("Only typed when Notepad is focused");
// With .exe (same: .exe is stripped)
var sim2 = new InputSimulator("notepad.exe");
// Explicit "exe" prefix (useful if the name could be a title)
var sim3 = new InputSimulator("exe mygame");
Bind by window title
Any string that does not look like a process name (no exe prefix, no .exe) is treated as a window title substring. The foreground window’s title is matched case-sensitively (to reduce accidental matches, e.g. with browser tabs that share similar text).
// Any window whose title contains "Visual Studio"
var sim = new InputSimulator("Visual Studio");
sim.Send("Ctrl+S"); // Only when such a window is focused
// Substring of the title bar
var sim2 = new InputSimulator("Untitled - Notepad");
Check and activate
- IsActiveWindow() —
trueif the current foreground window matches any of the filters passed to the constructor. - IsActiveWindow(string query) —
trueif the current foreground matches the given process/title query. - WinActivate(string query) — finds a window matching the query and brings it to the foreground; returns
trueif a window was activated.
var sim = new InputSimulator("notepad");
// Bring Notepad to front, then type only into it
if (sim.WinActivate("notepad"))
{
sim.SendText("Typed into Notepad");
}
// Optional: check before sending
if (sim.IsActiveWindow())
sim.Click(100, 100);
Full example: process-bound automation
using Poss.Win.Automation.Input;
// Only send input when "MyEditor.exe" is the active window
var sim = new InputSimulator("MyEditor");
sim.WinActivate("MyEditor"); // Focus the app first
sim.SendText("Hello");
sim.Send("Ctrl+S");
sim.MouseWheel(120); // Scroll up — no-op if another app is focused
// Without a filter, input goes to whatever is focused
var simAny = new InputSimulator();
simAny.Send("Escape");
Main types
- InputSimulator —
SendText,Send,Click,MouseWheel,MouseSetPos,MouseDeltaMove,MouseGetPos,WinActivate,GetWindowTitle,GetWindowPos,GetWindowProcessName,IsActiveWindow,GetKeyState, Filters (read-only filter collection), etc. - WindowFilter (struct) —
Name,Type(process or window title). Used in the Filters collection. - WindowFilterKind (enum) —
Process,Window. - ForegroundIdentity (struct) —
Hwnd,Pid; identifies a window for caching (e.g. to avoid stale match results when a process exits and the handle is reused).
Requirements
- .NET Standard 2.0
- Windows (uses Win32
SendInput, etc.)
License
MIT. See LICENSE in the repository.
Repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Poss.Win.Automation.Core (>= 1.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Poss.Win.Automation.Input:
| Package | Downloads |
|---|---|
|
Poss.Win.Automation
Windows automation library for keyboard and mouse input simulation, global hotkey registration, and window management. This package includes Input and GlobalHotKeys. For only input or only hotkeys, use Poss.Win.Automation.Input or Poss.Win.Automation.GlobalHotKeys. Targets .NET Standard 2.0. |
GitHub repositories
This package is not used by any popular GitHub repositories.