Press Key

This action presses a specified key. This is an application-level step that is available when you right-click the following:

  • The application tab.

  • A text field in an application or a web site.

  • A program point in the Desktop Automation robot.

Using the virtual input driver

When you enable the virtual input driver on the automated device (see Activate the virtual input driver in Configure Desktop Automation Service), Press Key steps in Device Automation on Windows automatically use this driver for entering text. The keys are entered as though via a hardware keyboard, enabling system-only combinations, such as Ctrl+Alt+Del to work. When using calculated keys, any flags other than "u" (for a key-up event) are not supported. The driver does not support holding down more than six keys at the same time.

Properties

Name
Name of the step.
Finder
Device: Select the name of the automation device.
Application: Specify the name of the application the action is performed in.
Key
Select Standard Keys or Calculated Key.
  • Standard Keys: Select from the standard keyboard keys, such as letters, numbers, punctuation marks, arrow keys, function keys, and more.
  • Calculated Key: Select this option if the provided options for keyboard keys are insufficient. In the Key Code field, specify a virtual-key code or a space-separated list of input specifications. This functionality is only supported on the Windows operating system.

    A virtual-key code is a symbolic constant name, such as VK_LBUTTON for "left mouse button." For the list of virtual-key codes, see the Microsoft documentation.

    An input specification is a sequence of one or more keydown or keyup events. When adding an input specification, specify a virtual-key code or scan code, using a respective prefix:

    • v for a virtual-key code, such as v0xXX.
    • s for a scan code, such as s0xXX.

    By default, an input specification is a keydown, virtual-key event. To override this default, add an f flag to an input specification and separate them by a comma. The following flags are supported: u for keyup; s for scan code; e for extended key; U for Unicode.

    Examples

    • The v0x30 v0x30,fu calculated key presses the zero key and then releases it. The v0x30 input specification is a keydown event, while v0x30,fu is a keyup event.

    • The v0x5b v0x52 v0x52,fu v0x5b,fu calculated key is for the Run command (Win+R): It presses the left Win key, then the R key, and then releases both keys. The v0x5b and v0x52 are keydown events, while v0x52,fu and v0x5b,fu are keyup events.

    • The s0x04c1,fU s0x04c1,fUu calculated key is for the Cyrillic character Ӂ (Zhe with breve). While the 0x04c1 code is the Unicode for Ӂ, s0x04c1,fU is a scan code, keydown event and s0x04c1,fUu is a scan code, keyup event.

Modifier
If you selected Calculated Key in the Key property, the Modifier property is ignored, and you do not need to configure it.
Select a key modifier:
  • Fixed Key Modifier: Contains three standard key modifiers, such as Shift, Ctrl, Alt.
  • Calculated Key Modifier: When this option is selected, specify a symbolic constant name of the virtual-key code for a modifier.

    In the text box that appears, you can enter the key codes for Shift, Ctrl, and Alt only. For example, the VK_LSHIFT key code stands for the left Shift key, VK_RCONTROL stands for the right Ctrl key, and VK_MENU stands for the Alt key. For a complete list of key codes, see the Microsoft documentation.

Count
Specify how many times to perform the action. The format is an equal sign and a number, such as =1.