KeyboardPress

Simulate a keyboard input

This CPH method uses the SendKeys method.

The keyPress string argument needs to be enclosed in curly brackets {}.

To use key combinations such as Shift, and Alt, you can use code modifiers listed in the link below.

Full reference of all SendKeys keystroke values and modifiers.
public void KeyboardPress(string keyPress)
keyPress
string required

The keystroke to send.

void
using System;

public class CPHInline
{
  public bool Execute()
  {
    // Examples:

    // 'W'
    CPH.KeyboardPress("{W}"); 
    // 'DOWN ARROW'
    CPH.KeyboardPress("{DOWN}"); 
    // 'SHIFT' and 'W'
    CPH.KeyboardPress("+{W}"); 
    // 'CTRL' and 'W'
    CPH.KeyboardPress("^{W}"); 
    // 'ALT' and 'W'
    CPH.KeyboardPress("%{W}"); 
    return true;
  }
}