Global Send Key|Global Send Key Events in Blueprism

The ‘Global Send Key Events’ function sends keystroke ‘events’ to the active application, which is not necessarily the target application. Keys are processed by whatever has focus. This differs from the Global Send Keys function which sends keystrokes to the attached application (whichever object the Application Modeller is attached to).

‘Global Send Key Events’ uses a lower-level method of sending the keys, and therefore is more likely to work with some applications. A specific example of this is a Citrix client, which will not respond to ‘Global Send Keys’ but will work with ‘Global Send Key Events’ (see related articles about sending keys to Citrix).

Parameters:

The parameter ‘Text’ is used to specify the string value which corresponds to the key events to send.

The above example demonstrates pressing a CTRL+s key combination. The order of key presses is the key down signal (i.e. hold the key down), the special code for the Control key, the ‘s’ key, the key up signal (i.e. release the key), and the Control key code as the key to be released.

The syntax for this parameter value is as follows:

  • All normal characters, e.g. “A”, “9”, just get sent as that key. A key down followed by a key up is sent.
  • Special keys are enclosed in {curly brackets}. This allows things such as {HOME} and {ALT} to be sent.
  • The < and > characters are used to modify the NEXT key to be just a key down < or key up > event respectively.
    • NOTE: Since “{“, “}”, “<” and “>” are special characters, they must be sent as follows: {{} {}, {<} and {>}

Examples:

“hello{RETURN}” – sends HELLO and presses return
“<{CTRL}A>{CTRL}” – presses the ctrl key down, then presses A, then releases the ctrl key
“<{ALT}AB>{ALT}” – presses the alt key down, then presses A, then B, then releases the alt key – i.e. does Alt-A, Alt-B
“<{ALT}A>{ALT}B” – presses the alt key down, then presses A, then releases the alt key and pressed B – i.e. does Alt-A, B
“<{CTRL}<{SHIFT}{ESCAPE}>{SHIFT}>{CTRL}” – presses ctrl and shift, then escape, then lets go of ctrl and shift

SENDING CAPITAL LETTERS using SHIFT

The format for sending capital letters via Global Send Key Events is like this:

“<{SHIFT}s>{SHIFT}”

This would send a capital “S”.

The importance of focus

It is necessary for the application to have the focus in order for Global Send Key Events to work, otherwise nothing is sent. To retain the focus when the keys are being sent it may be necessary to launch the window and then immediately send the keys as the next step.

It may be necessary for you to create a completely new Business Object whose sole purpose it to connect to the target application’s main window. This is especially required when working with applications such as mainframe emulators. If you are trying to send keys to a mainframe session hosted within a mainframe emulator product then you will need a Win32 object to activate the emulator window and then send keys to that window, rather than to the underlying mainframe session.

Special key combinations recognised by the target application

The characters being sent cannot have a different meaning. In other words, if you’re sending SHIFT+A for example, if that is interpreted by the application as a shortcut for the function “Select All”, then that is what would occur, rather than the sending of a capital A letter.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s