boolean
SendKeys.AppActivateByHandle(number WindowHandle)
Activate the window passed Window
Handle. Returns true if successful.
Example:
--Get the handle to the
application
handle = Application.GetWndHandle();
--minimize the window
Window.Minimize(handle);
--wait 5 seconds
Application.Sleep(5000);
--activate the app
SendKeys.AppActivateByHandle(handle)
--set the focus to the input box
Page.SetFocus("Input1")
--send text to the input box
-- ^A sends Control A to select all, {DEL} sends the delete
key
SendKeys.Send("^A{DEL}Time to Wake UP!", 2)
boolean
SendKeys.AppActivateByTitle(string WindowTitle)
Activates the window having the title
passed. Returns true if successful.
Example:
File.Open("Notepad.exe", "", SW_MINIMIZE);
while SendKeys.AppActivateByTitle("Untitled - Notepad") ==
false do
--wait for notepad to start
end
--send the keystrokes
SendKeys.Send("Sit back and relax.{DELAY 500}.{DELAY
500}.{DELAY 500}.{DELAY 500}.", 5, true);
SendKeys.Send("%FSThis is the file name.txt", 10, true);
SendKeys.Send(String KeysToSendToTheActiveWindow)
Sends the keys that are specified to
the active window. See the tables below for syntax
|
Key |
Code |
| BACKSPACE |
{BACKSPACE},
{BS}, or {BKSP} |
| BREAK |
{BREAK} |
| CAPS LOCK |
{CAPSLOCK} |
| DEL or DELETE |
{DELETE} or {DEL} |
| DOWN ARROW |
{DOWN} |
| END |
{END} |
| ENTER |
{ENTER} or ~ |
| ESC |
{ESC} |
| HELP |
{HELP} |
| HOME |
{HOME} |
| INS or INSERT |
{INS} |
| LEFT ARROW |
{LEFT} |
| NUM LOCK |
{NUMLOCK} |
| PAGE DOWN |
{PGDN} |
| PAGE UP |
{PGUP} |
| PRINT SCREEN |
{PRTSC} (reserved
for future use) |
| RIGHT ARROW |
{RIGHT} |
| SCROLL LOCK |
{SCROLL} |
| TAB |
{TAB} |
| UP ARROW |
{UP} |
| F1 |
{F1} |
| F2 |
{F2} |
| F3 |
{F3} |
| F4 |
{F4} |
| F5 |
{F5} |
| F6 |
{F6} |
| F7 |
{F7} |
| F8 |
{F8} |
| F9 |
{F9} |
| F10 |
{F10} |
| F11 |
{F11} |
| F12 |
{F12} |
| F13 |
{F13} |
| F14 |
{F14} |
| F15 |
{F15} |
| F16 |
{F16} |
| Keypad add |
{ADD} |
| Keypad subtract |
{SUBTRACT} |
| Keypad multiply |
{MULTIPLY} |
| Keypad divide |
{DIVIDE} |
|
Key |
Code |
| + |
{PLUS} |
| @ |
{AT} |
| APPS |
{APPS} |
| ^ |
{CARET} |
| ~ |
{TILDE} |
| { } |
{LEFTBRACE}
{RIGHTBRACE} |
| ( ) |
{LEFTPAREN} {RIGHTPAREN} |
| Left/Right WINKEY |
{LWIN} {RWIN} |
| WINKEY |
{WIN} equivalent
to {LWIN} |
|
Command Syntax |
Action |
| {VKEY
X} |
Sends the VKEY of value X.
For example, {VKEY 13} is
equivalent to VK_RETURN. |
| {BEEP
X Y}} |
Beeps
with a frequency of X and a duration of Y
milliseconds. |
|
{DELAY X} |
Delays sending the next key of X milliseconds. After
the delaying the following key, the subsequent keys
will not be further delayed unless there is a
default delay value (see DELAY=X).
Example: {DELAY 1000} <--
delays subsequent key stroke for 1 second. |
|
{DELAY=X} |
Sets
the default delay value to X milliseconds. This will
cause every key to be delayed X ms.
If a value is already set and
you specify {DELAY Y} you will have your following
key delay Y ms but the subsequent keys will be
delayed X ms.
Example: {DELAY=1000} <-- all
subsequent keys will be delayed for 1 second.
|
| {APPACTIVATE
WindowTitle} |
Activates an application using is WindowTitle.
Very useful if you want to
send different keys to different applications. |
Modifiers
|
Key |
Code |
| WINKEY |
@ |
| SHIFT |
+ |
| CTRL |
^ |
| ALT |
% |
|