Link to OpenSpan Help Home
SendKeys Method
Use the SendKeys method to send a key command to a control. See the Sample Automation for example using the SendKeys method. The SendKeys method has two parameters as shown in the design block below:
Use the keys parameter to send key values or commands:
Send a keyboard value by typing the value. For example, send the text ATL to a control by typing ATL in the keys parameter.
Send keyboard command by
enclosing the command in curly brackets. For example, send the Tab
keyboard command by typing {TAB}
in the keys parameter. See the Keyboard Command List
for more information.
The plus sign (+), caret (^), percent sign (%), tilde (~),
and parentheses () have special meanings to this method. To send any
of these as literal characters, enclose the character in braces. For
example, to send the plus sign, enter {+} for the command.
Enclose each bracket in brace {[}, even though square brackets [ ] do not have a special meaning to the SendKeys method.
Specify keys combined with any combination of the Shift, Ctrl, and Alt keys by preceding the key code with one or more of the following codes.
Key |
Code |
SHIFT |
+ |
CTRL |
^ |
ALT |
% |
Specify that any combination of Shift, Ctrl, and Alt should be held down while several other keys are pressed and enclose the code for those keys in parentheses. For example, to specify to hold down Shift while E and C are pressed, use +(EC). To specify to hold down Shift while E is pressed, followed by C without Shift use +EC.
In the Text adapter, there are methods defined for specific keys to be pressed, such as F3 and Enter, or you can use SendKeys(WinHllapiKey key). The SendKeys(string keys) method does not support the {xxx} format. Send plain text with the SendKeys(string) method.
Specify repeating keys by using the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the left arrow key 42 times.
Use the focus parameter to specify whether the control should receive focus when the key or command is sent. This parameter is usually set to True to focus the control.