Key Sequence Executor

This is a utility to send key strokes to a remote computer to enable simulation of remote key strokes.
This is useful for when you for example want to update a remote computer with an application where you keep statistics for your tests, but have your tests running from another computer.
Since the utility utilizes a web server it should be runnable on any Windows host, and accessible from any other machine through the REST API.

Download and installation

Download the zip file and unzip it anywhere on the computer where you want your keystrokes to be executed. The file KeyboardExecutor.exe is the main program. This program reads settings from a few JSON files and uses the included DLL files to run the REST server.

Starting the server

Usage:

Just run the application from its directory to start the REST server:

   KeyboardExecutor.exe

The server will use port 5000 by default. The port could be changed in the launchSettings.json file.

Usage

There are a few different ways of using this utility:

HTTP POST

HTTP POST with plain text body

Anything posted with HTTP header Content-Type = text/plain will be forwarded to the System.Windows.Forms.SendKeys() method on the serverthe server is running on.

   curl -H "Content-Type: text/plan" --request POST http://myrunningserver:5000 --data "These are the keystrokes to send{ENTER}"

HTTP POST with JSON body

Posting a JSON structure provides a little more control. By posting with JSON you may include a pause, and/or a window title to be activated prior to the key strokes. Window titles are expressed as regular expression patterns.

   curl -H "Content-Type: application/json" --request POST http://myrunningserver:5000 --data '{"KeySequence":"Halloj", "PauseInMilliseconds": "1500", "WindowTitleAsRegex": ".* Notepad.* "}'

HTTP GET

A plain HTTP GET request will produce this help information.

   curl http://myrunningserver:5000 

Command line usage

Using the program with arguments will concaternate the arguments into a key sequence to send. E.g.

  KeyboardExecutor.exe This is the text{ENTER}that should be sent.

The above command will send the text sequence:

This is the text
        that should be sent.

When using command line arguments they will be treated as input and this program will terminate after sending key commands.

SendKeys reference

Special keys syntax for the SendKeys method used are listed here:https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=netframework-4.5