RPA- UiPath, Regarding Special Keystrokes

KHV picture KHV · Nov 6, 2018 · Viewed 13.9k times · Source

How to send the keystrokes such as Alt +E+A+B, tried to send the keys using type into while working with, Alt the button is not getting released after the process is closed. Also tried to send Alt+E but not able to send the rest of the Key strokes, is there any way to send all the key strokes at a time.

Any suggestion will helpful.

Answer

codemonkee picture codemonkee · Jan 6, 2019

You have a few options depending on how you want to pass along the special keys. As referenced by @Sebax in the Question's comments and @Mads T's answer I thought it would be good to go into more details.

When using Type Into activity, you have three methods depending on your needs

  1. Default Slowest of the three methods, using the hardware driver. It does NOT automatically erase pre-existing text nor does it work in the background, but supports special key strings (e.g. [k(enter)])
  2. SendWindowMessages It does NOT automatically erase pre-existing text but does work in the background while supporting special key strings (e.g. [k(enter)])
  3. SimulateType is the fastest of the three methods. It automatically erases pre-existing text and works in the background but does not support special key strings (e.g. [k(enter)]), in this case, you'll want to pair it with the Send Hotkey activity.

Special Key Strings

I've seen mention of k, d, and u in the UiPath Forums here and there, but have not seen official documentation that explains the modifiers or lists out the available special characters asides from looking at the Send Hotkey dropdown list.

  • k: Synthesize a key down (press) followed by a key up (release) for the specified key.
  • d: Synthesize a key down (press and hold) event for the specified key.
  • u: Synthesize a key up (release) event for the specified key.

Special Key examples

  1. "Hello[k(enter)" will type out "Hello" followed by a carriage return.
  2. "[d(alt)]efun[u(alt)]Hello[k(enter)k(esc)]" would
    1. Press down and hold the Alt key
    2. Press the keys e, f, u, and n
    3. Release the Alt Key
    4. Type the characters Hello
    5. Press the Enter key
    6. Press the Esc key

Send Hotkey The send hotkey is pretty straightforward. Indicate the key(s) you want to send and if needed check the key modifiers (Alt, Ctrl, Shift, Win). If the key you are sending is a special key (e.g. Enter), then you'll also want to enable the SpecialKey property of the activity.

Send Hotkey can use the Default or SendWindowMessages inputs.

Send Hotkey

References: