KeyPressProcess 0.0.1.1

dotnet add package KeyPressProcess --version 0.0.1.1
NuGet\Install-Package KeyPressProcess -Version 0.0.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KeyPressProcess" Version="0.0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KeyPressProcess --version 0.0.1.1
#r "nuget: KeyPressProcess, 0.0.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 Compatible and additional computed target framework versions.
.NET net7.0-windows7.0 is compatible.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 161 7/2/2023