Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keystroke question

Status
Not open for further replies.

finitesimian

Programmer
Feb 11, 2006
29
US
This question is one of those "probably not, but I thought I'd ask anyway" questions:

I was wondering if it was possible to use the "escape" or "control" keys in sendkeys statements?

For example "<Home><BackTab><Escapekey?><Controlkey?><Enter>"


A second question --- is it possible to use key combinations using sendkey statements (example "<Home><BackTab><Cntrl+v><Enter>") <---BTW- I'm just using "cntrl+v" as an example of functional keystroke combo. I'm not attempting to paste a string (there are obviously easier ways to do this)




 
I think it depends on what you are trying to accomplish. For me, the escape key is for resetting, so when I want to use it I use "<Reset>".

What actions are you trying to perform that require the ControlKey?
 
Am not sure if this answers your question,,however you can try ..Sess0.Screen.GetString(1,28, 1,30, xBlock)
Sess0.Screen.Copy
Sess0.Screen.Paste

 
SendKeys string-expression[, wait]

Sends keystrokes to the active application.

Parameter Description
string-
expression The keystrokes to be sent. For details, refer to the Comments section below.
wait If True, SendKeys does not return until all keys are processed. If False, SendKeys does not wait for an application to process the keys. The default wait value is False.
Comments

In string-expression, to specify that SHIFT, ALT, or CONTROL keys should be pressed simultaneously with a character, use appropriate prefix from the table below:
+ to specify SHIFT
% to specify ALT
^ to specify CONTROL
Parentheses may be used to specify that SHIFT, ALT, or CONTROL key should be pressed with a group of characters. For example, ''%(abc)'' is equivalent to ''%a%b%c''.

Since '+', '%', '^' ,'(' and ')' have special meaning to SendKeys, they must be enclosed in braces. For example string-expression''{%}'' specifies a percent character '%'.
The other characters that need to be enclosed in braces are '~' which stands for a newline or ''Enter'' if used alone, and braces themselves (use {{} to send '{' and {}} to send '}'). Brackets '[' and ']' do not have special meaning in EXTRA! Basic but may have special meaning in other applications, therefore, they need to be enclosed inside braces as well.

To specify that a key needs to be sent several times, enclose the character in braces, followed by a space, followed by the number of times the character is to be sent. For example, use {X 20} to send 20 characters 'X'.
To send a non-printable key, use a special keyword enclosed with braces:

Key Keyword
Backspace {BACKSPACE} or {BKSP} or {BS}
Break {BREAK}
Caps Lock {CAPSLOCK}
Clear {CLEAR}
Delete {DELETE} or {DEL}
Down Arrow {DOWN}
End {END}
Enter {ENTER}
Esc {ESCAPE} or {ESC}
Help {HELP}
Home {HOME}
Insert {INSERT}
Left Arrow {LEFT}
Num Lock {NUMLOCK}
Page Down {PGDN}
Page Up {PGUP}
Right Arrow {RIGHT}
Scroll Lock {SCROLLLOCK}
Tab {TAB}
Up Arrow {UP}
To send one of function keys F1-F15, enclose the name of the key inside braces. For example, to send F5 use {F5}.
Note that special keywords can be used in combination with +, %, and ^. For example: %{TAB} means Alt-Tab. Also, you can send several special keys as you would send several normal keys: {UP 25} sends 25 Up arrows.
SendKeys can send keystrokes only to the currently active application. Use the AppActivate statement to activate an application.
SendKeys cannot be used to send keys to an application which was not designed to run under Windows.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top