Global Send Keys and Send Key Events

#1
What is the Global Send Keys and Send Key Events ?

Why we need Global Send Keys and Send Key Events ?

When we have to use Global Send Keys and Send Key Events ?

How to Implement Global Send Keys and Send Key Events ?

Please give Real Time Usage Global Send Keys and Send Key Events with examples
 
Last edited:
#2
Send Keys and Send Key Events

Where a technical interface is unavailable for an application or an element within an application a Write stage
might not work as a method of inputting text into screen elements. Where that is the case Blue Prism provide two
text input methods that will work with any application:

Global Send keys
Send Keys will work for most applications and should be tried before Send Key Events. It is a higher-level
interface that sends keystrokes to the active application.

Global Send Key events
Send Key Events will work for all applications and is the text sending method recommended for Citrix
applications. It is a lower-level interface that mimics keyboard keystrokes in the operating system.
Send Keys and Send Key Events are part of the interface techniques that make up the Blue Prism Surface
Automation interface.

Unlike other interfaces where a write stage will populate an element with text even when that element is not
visible, there are some factors that need to be in place for Global Send Key interfaces to work robustly:

• The desktop screen must exist and be persistent. Send Key interfaces will not work if the desktop screen is
locked or a screensaver is displayed
• The window that you want to send text into must be activated to be the topmost window of all running
applications
• The element within the window you want to send text into must be focused so that the keyboard cursor is
within it ready to enter text
• To ensure the application has time to react to any window or element focus navigation tiny delays are
required between window activates, element clicks, and using Send Keys
• To ensure text is entered reliable a tiny delay should be placed between each keystroke. Experience in the
use of Send Keys interfaces has shown that for some applications entering text too quickly can result in
some characters not being correctly entered.

When to use Send Keys or Send Key Events

Global keystrokes should be used when other methods of inputting text do not work, either because a thin client technology such as Citrix is being used, or because the element within an application either cannot be identified by application modeller or does not accept the use of a write stage.
If one interface method of sending text to an application does not work a developer should move onto trying a different method until a technique that works is found.

Different methods of entering test into an application should be attempted in the following order:

1. Write stage. Sending text using a write stage uses technological interfaces specific for the application type.
2. Windows Press Keys. For some applications this action in a navigate stage will work to send text. None of the window activation or element focus methods mentioned in this document are required.
3. Global Send Keys. This option should be tried before Global Send Keys because it is a higher level interface and easier to use control keys.
4. Global Send Key events. This is the final option and should always work. It is the only option that will work when interfacing with Citrix applications. Even where Global Send Keys works this option can be useful for some use cases where a key needs to be held down on it’s own whilst other actions are performed.



Blue Prism version 6 included some major improvements in the Surface Automation interfaces to make it far easier to implement the techniques required to robustly use Global Send Keys.
This image is of a version 6 navigate stage using the Global Send Keys action:

View attachment 1529992837486.png

This Blue Prism version 6 navigate stage contains all the actions required for Global Send Keys to work robustly:
1. The Main Window of the application is brought to focus using the Activate Application action
2. The edit or text box we want to send keystrokes to is made active by using a Global Mouse Click Centre action
3. Global Send Keys to send the data to the application. The Input parameters to this action is the text we want to send and the interval between keystrokes which has been set to be 0.1 seconds
4. The ‘Pause After Each Step’ setting to 0.25 seconds. The correct pause number to for your own interface will depend upon the responsiveness of applications within your environment. This will usually be a number between 0.25 and 1 seconds.

Using Global Send Keys with Blue Prism version 5 or earlier
In earlier versions of Blue Prism the actions required to robustly use Global Send Keys could not be implemented in a single navigate stage. Instead the object flow to use send keys would look like the following images:
View attachment 1529992888361.png
Send Key and Send Key Events Syntax
When sending text using Global Send Keys and Global Send Key events there is a specific text format that must be used when sending control keys such as function keys, Shift, Alt, or Ctrl.
The different syntaxes are fully described in the sections below. However, the following table is a quick cheat sheet is offered which explains both quickly.
Cheat Sheet:
View attachment table.JPG

Send Keys
Send Keys talks directly to the application that an object is connected to. This method uses the following mnemonics to indicate for the Shift, Control and Alt keys:
• Shift: +
• Control: ^
• Alt: %
Special keys like for example Home must always be enclosed in braces. i.e. {HOME}.
To specify that any combination of Shift, Control and Alt should be held down while several other keys are pressed, enclose the code for those keys in parentheses. I.e. to specify to hold down Shift while E and C are pressed, use "+(EC)". On the other hand, to tell the application to hold down Shift while E is pressed followed by C without Shift, use "+EC".
Send Keys offers the option to repeat a key press a given number of times. For such functionality the number of times must appear after the name of the key. I.e. {LEFT 10} tells Send Keys to press the Left arrow key 10 times.

View attachment table2.JPG
Hope You got required Information.
 
#5
Send Keys and Send Key Events

Where a technical interface is unavailable for an application or an element within an application a Write stage
might not work as a method of inputting text into screen elements. Where that is the case Blue Prism provide two
text input methods that will work with any application:

Global Send keys
Send Keys will work for most applications and should be tried before Send Key Events. It is a higher-level
interface that sends keystrokes to the active application.

Global Send Key events
Send Key Events will work for all applications and is the text sending method recommended for Citrix
applications. It is a lower-level interface that mimics keyboard keystrokes in the operating system.
Send Keys and Send Key Events are part of the interface techniques that make up the Blue Prism Surface
Automation interface.

Unlike other interfaces where a write stage will populate an element with text even when that element is not
visible, there are some factors that need to be in place for Global Send Key interfaces to work robustly:

• The desktop screen must exist and be persistent. Send Key interfaces will not work if the desktop screen is
locked or a screensaver is displayed
• The window that you want to send text into must be activated to be the topmost window of all running
applications
• The element within the window you want to send text into must be focused so that the keyboard cursor is
within it ready to enter text
• To ensure the application has time to react to any window or element focus navigation tiny delays are
required between window activates, element clicks, and using Send Keys
• To ensure text is entered reliable a tiny delay should be placed between each keystroke. Experience in the
use of Send Keys interfaces has shown that for some applications entering text too quickly can result in
some characters not being correctly entered.

When to use Send Keys or Send Key Events

Global keystrokes should be used when other methods of inputting text do not work, either because a thin client technology such as Citrix is being used, or because the element within an application either cannot be identified by application modeller or does not accept the use of a write stage.
If one interface method of sending text to an application does not work a developer should move onto trying a different method until a technique that works is found.

Different methods of entering test into an application should be attempted in the following order:

1. Write stage. Sending text using a write stage uses technological interfaces specific for the application type.
2. Windows Press Keys. For some applications this action in a navigate stage will work to send text. None of the window activation or element focus methods mentioned in this document are required.
3. Global Send Keys. This option should be tried before Global Send Keys because it is a higher level interface and easier to use control keys.
4. Global Send Key events. This is the final option and should always work. It is the only option that will work when interfacing with Citrix applications. Even where Global Send Keys works this option can be useful for some use cases where a key needs to be held down on it’s own whilst other actions are performed.



Blue Prism version 6 included some major improvements in the Surface Automation interfaces to make it far easier to implement the techniques required to robustly use Global Send Keys.
This image is of a version 6 navigate stage using the Global Send Keys action:

View attachment 1200

This Blue Prism version 6 navigate stage contains all the actions required for Global Send Keys to work robustly:
1. The Main Window of the application is brought to focus using the Activate Application action
2. The edit or text box we want to send keystrokes to is made active by using a Global Mouse Click Centre action
3. Global Send Keys to send the data to the application. The Input parameters to this action is the text we want to send and the interval between keystrokes which has been set to be 0.1 seconds
4. The ‘Pause After Each Step’ setting to 0.25 seconds. The correct pause number to for your own interface will depend upon the responsiveness of applications within your environment. This will usually be a number between 0.25 and 1 seconds.

Using Global Send Keys with Blue Prism version 5 or earlier
In earlier versions of Blue Prism the actions required to robustly use Global Send Keys could not be implemented in a single navigate stage. Instead the object flow to use send keys would look like the following images:
View attachment 1201
Send Key and Send Key Events Syntax
When sending text using Global Send Keys and Global Send Key events there is a specific text format that must be used when sending control keys such as function keys, Shift, Alt, or Ctrl.
The different syntaxes are fully described in the sections below. However, the following table is a quick cheat sheet is offered which explains both quickly.
Cheat Sheet:
View attachment 1202

Send Keys
Send Keys talks directly to the application that an object is connected to. This method uses the following mnemonics to indicate for the Shift, Control and Alt keys:
• Shift: +
• Control: ^
• Alt: %
Special keys like for example Home must always be enclosed in braces. i.e. {HOME}.
To specify that any combination of Shift, Control and Alt should be held down while several other keys are pressed, enclose the code for those keys in parentheses. I.e. to specify to hold down Shift while E and C are pressed, use "+(EC)". On the other hand, to tell the application to hold down Shift while E is pressed followed by C without Shift, use "+EC".
Send Keys offers the option to repeat a key press a given number of times. For such functionality the number of times must appear after the name of the key. I.e. {LEFT 10} tells Send Keys to press the Left arrow key 10 times.

View attachment 1203
Hope You got required Information.
thanks, this was really useful. Now I know that Sending Keys is little of a last resort when it comes to solve a problem since it can give you some unwanted results.
 
#15
Send Keys and Send Key Events

Where a technical interface is unavailable for an application or an element within an application a Write stage
might not work as a method of inputting text into screen elements. Where that is the case Blue Prism provide two
text input methods that will work with any application:

Global Send keys
Send Keys will work for most applications and should be tried before Send Key Events. It is a higher-level
interface that sends keystrokes to the active application.

Global Send Key events
Send Key Events will work for all applications and is the text sending method recommended for Citrix
applications. It is a lower-level interface that mimics keyboard keystrokes in the operating system.
Send Keys and Send Key Events are part of the interface techniques that make up the Blue Prism Surface
Automation interface.

Unlike other interfaces where a write stage will populate an element with text even when that element is not
visible, there are some factors that need to be in place for Global Send Key interfaces to work robustly:

• The desktop screen must exist and be persistent. Send Key interfaces will not work if the desktop screen is
locked or a screensaver is displayed
• The window that you want to send text into must be activated to be the topmost window of all running
applications
• The element within the window you want to send text into must be focused so that the keyboard cursor is
within it ready to enter text
• To ensure the application has time to react to any window or element focus navigation tiny delays are
required between window activates, element clicks, and using Send Keys
• To ensure text is entered reliable a tiny delay should be placed between each keystroke. Experience in the
use of Send Keys interfaces has shown that for some applications entering text too quickly can result in
some characters not being correctly entered.

When to use Send Keys or Send Key Events

Global keystrokes should be used when other methods of inputting text do not work, either because a thin client technology such as Citrix is being used, or because the element within an application either cannot be identified by application modeller or does not accept the use of a write stage.
If one interface method of sending text to an application does not work a developer should move onto trying a different method until a technique that works is found.

Different methods of entering test into an application should be attempted in the following order:

1. Write stage. Sending text using a write stage uses technological interfaces specific for the application type.
2. Windows Press Keys. For some applications this action in a navigate stage will work to send text. None of the window activation or element focus methods mentioned in this document are required.
3. Global Send Keys. This option should be tried before Global Send Keys because it is a higher level interface and easier to use control keys.
4. Global Send Key events. This is the final option and should always work. It is the only option that will work when interfacing with Citrix applications. Even where Global Send Keys works this option can be useful for some use cases where a key needs to be held down on it’s own whilst other actions are performed.



Blue Prism version 6 included some major improvements in the Surface Automation interfaces to make it far easier to implement the techniques required to robustly use Global Send Keys.
This image is of a version 6 navigate stage using the Global Send Keys action:

View attachment 1200

This Blue Prism version 6 navigate stage contains all the actions required for Global Send Keys to work robustly:
1. The Main Window of the application is brought to focus using the Activate Application action
2. The edit or text box we want to send keystrokes to is made active by using a Global Mouse Click Centre action
3. Global Send Keys to send the data to the application. The Input parameters to this action is the text we want to send and the interval between keystrokes which has been set to be 0.1 seconds
4. The ‘Pause After Each Step’ setting to 0.25 seconds. The correct pause number to for your own interface will depend upon the responsiveness of applications within your environment. This will usually be a number between 0.25 and 1 seconds.

Using Global Send Keys with Blue Prism version 5 or earlier
In earlier versions of Blue Prism the actions required to robustly use Global Send Keys could not be implemented in a single navigate stage. Instead the object flow to use send keys would look like the following images:
View attachment 1201
Send Key and Send Key Events Syntax
When sending text using Global Send Keys and Global Send Key events there is a specific text format that must be used when sending control keys such as function keys, Shift, Alt, or Ctrl.
The different syntaxes are fully described in the sections below. However, the following table is a quick cheat sheet is offered which explains both quickly.
Cheat Sheet:
View attachment 1202

Send Keys
Send Keys talks directly to the application that an object is connected to. This method uses the following mnemonics to indicate for the Shift, Control and Alt keys:
• Shift: +
• Control: ^
• Alt: %
Special keys like for example Home must always be enclosed in braces. i.e. {HOME}.
To specify that any combination of Shift, Control and Alt should be held down while several other keys are pressed, enclose the code for those keys in parentheses. I.e. to specify to hold down Shift while E and C are pressed, use "+(EC)". On the other hand, to tell the application to hold down Shift while E is pressed followed by C without Shift, use "+EC".
Send Keys offers the option to repeat a key press a given number of times. For such functionality the number of times must appear after the name of the key. I.e. {LEFT 10} tells Send Keys to press the Left arrow key 10 times.

View attachment 1203
Hope You got required Information.

Hi Sukesh,

Thanks for the nice explanation.
Could you please advise on below issue:-

Hi All,

My requirement is to Launch Notepad, enter some text using Send Keys & save it.

1st I tried with Global Send Keys:- Text I have entered is "Hello & Welcome to UK" to display in Notepad. It display as usual.

In the next attempt Global Send Keys Events:- I have entered the sam etext, but it displays in Notepad as: Hello 7 Welcome to UK

Why the Shift Key is not working with Global Send Keys Events ?

Thank you.
 
#16
Global send keys and global send key events use different notation for the Shift, Ctrl and Alt keys so you'll need to make a small change when switching between the two methods.
In global send keys, shift is +, in global send key events, use {SHIFT}. Ctrl changes from ^ in GSKs to {CTRL} in GSKEs and Alt from % to {ALT}.
 
#18
Hi Team,
Anyone know the syntax for below operation: alt+E+S+V

I need to enter this using global nsend keys in Excel.

please tell how I can enter?

Thanks
Nitin
 
Top