15-02-22 03:16 PM
15-02-22 04:43 PM
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:
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.
I hope I've helped