KeyPressProcess 0.0.1.1
dotnet add package KeyPressProcess --version 0.0.1.1
NuGet\Install-Package KeyPressProcess -Version 0.0.1.1
<PackageReference Include="KeyPressProcess" Version="0.0.1.1" />
paket add KeyPressProcess --version 0.0.1.1
#r "nuget: KeyPressProcess, 0.0.1.1"
// Install KeyPressProcess as a Cake Addin #addin nuget:?package=KeyPressProcess&version=0.0.1.1 // Install KeyPressProcess as a Cake Tool #tool nuget:?package=KeyPressProcess&version=0.0.1.1
KeyPressProcess NuGet Package
Description
Send key presses to any process by bringing them to the front (as focused window).
Useful for automation, like dealing with installation pop-ups,
or anything that requires the user's manual interaction.
Mouse control is not supported, but you can use special keys like {TAB}
and {ENTER}
to navigate through forms.
All keyboard keys are available, including special keys.
Installation
Requires dotnet 7 for windows.
dotnet add package KeyPressProcess
How to use
Without dependency-injection:
var settings = new KeyPressProcess.AppSettings() {
Process = { Name = "notepad", MainWindowTitle = "Notepad", TakeMax = 1 },
Retry = { Every = TimeSpan.FromSeconds(5) },
ExecuteUntilMinSuccess = 1,
ExecuteForever = false,
KeySequence = "Hi,{WAIT-300}{ENTER}{TAB} how are you?"
};
var keyPressProcess = new KeyPressProcessService();
await keyPressProcess.Execute(settings);
With dependency-injection:
Register the classes in the dependency container.
If you are using Microsoft.Extensions.DependencyInjection
then you can use this extension:
using KeyPressProcess;
.ConfigureServices((hostContext, services) => {
services.RegisterKeyPressProcess();
public class MyClass {
private readonly IKeyPressProcess _keyPressProcess;
public MyClass(IKeyPressProcess keyPressProcess) {
_keyPressProcess = keyPressProcess;
}
public async Task DoSomething() {
var settings = new KeyPressProcess.AppSettings() {
Process = { Name = "notepad" },
ExecuteUntilMinSuccess = 1,
KeySequence = "{ENTER}Hi, how are you?{TAB}"
};
await _keyPressProcess.Execute(settings);
}
}
Setting options
For a complete options description, see the main ReadMe Configuration section.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0-windows7.0 is compatible. net8.0-windows was computed. |
-
net7.0-windows7.0
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 7.0.0)
- Scrutor (>= 4.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.1.1 | 191 | 7/2/2023 |