<< Click to Display Table of Contents >> Navigation: 3. Script Language > Keyboard Typing Simulation > Keyboard Typing Simulation |
MiniRobotLanguage (MRL)
KYD. Command
Key Down Simulation
Intention
The KYD..-Command can be used to simulate Keyboard button press.
It's the most compatible and "Low Level" Keyboard simulation we have. Using it, you can even make window to bring you the Task-Manager up, by simulating a Key-press:
' Bring Windows Task-Manager up
KYD.{STRG},{SHIFT},{ESC}
PAU.0.100
KYU.{STRG},{SHIFT},{ESC}
ENR.
KYD. understands three sorts of parameters. These are:
• Special Sequences in {..} like {SHIFT}
• Letters and numbers, in ".." like "A" or "B". There is no difference between upper- and lowecase letters, because the letter size depends on the state of the SHIFT-Key..
• dezimal numbers like 65 (would be the same like "A" or "a")
You can NOT use multiple letters between the "..".
All these Parameters can be used in a single statement. They must be separated by comma. Here is an example:
' Open "File Open Dialog" in WordPad
STW.ct|WordPadClass|- WordPad
KYD.{STRG},"o"
KYU.{STRG},"o"
ENR.
Here is the same example using numbers:
' Open "File Open Dialog" in WordPad
STW.ct|WordPadClass|- WordPad
KYD.17,79
' You can mix numbers and chars
KYU.17,"o"
ENR.
Important: Always use KYD. and KYU. paired. Otherwise you will end up with Keys pressed after your script has ended.
Advanced Hint:
If you have Problems to delete the Content in a Browser-Edit Control, you can use this combination:
'-----------
:mark_all
MLI.
PAU.0.1
KYD.{STRG}
SKP.a
PAU.0.1
KYU.{STRG}
PAU.0.2
RET.
'-----------
:del_all
GSB.mark_all
SKP.{BS}
RET.
'-----------
You can read more about Keyboard-Simulation and Text-Boxes in the chapter:
Syntax
KYD.P1
Parameter Explanation
P1 - VAR or STRING
All Low-Level-Keycodes: see:
Here are just some often used keycodes:
Special- Keycode Simulates:
Sequence
{BS},{BACKSPACE} - 8 - BACKSPACE (deletes to left side)
{TAB} - 9 - TAB
{DEL},{CLEAR} - 12 - Delete-Key (deletes to right side),
see also 46
{RETURN} - 13 - RETURN-Key
{SHIFT} - 16 - SHIFT-Key (general), for L/R see
160,161
{CTRL},{STRG} - 17 - CTRL-Key (general), for L/R see
162,163
{ALT},{MENU} - 18 - ALT-/MENU-Key (general), for L/R
see 164 and 165
{POS1},{HOME} - 36 - HOME/POS1-Key
{LEFT} - 37 - Left Arrow-Key
{UP} - 38 - Up Arrow-Key
{RIGHT} - 39 - Right Arrow-Key
{DOWN} - 40 - Down Arrow-Key
{INSERT} - 45 - INSERT-Key
{DELETE} - 46 - DELETE-Key
{LWIN} - 91 - Left Windows-Button
{RWIN} - 92 - Right Windows Button
{LSHIFT} - 160 - Left SHIFT Key
{RSHIFT} - 161 - Right SHIFT Key
{LCTRL},{LSTRG} - 162 - Left CTRL-Key
{RCTRL},{RSTRG} - 163 - Right CTRL-Key
{LALT},{LMENU} - 164 - Left ALT-Key
{RALT},{RMENU} - 165 - Right ALT-Key, ALT Gr.
Hint: To get ALT Gr, you need to use the
two Keys: 165 and 162. See example below.
{OEM_1},{UE},{UML_UE} - 186 - German "Ü"-Umlaut
{OEM_3},{OE},{UML_OE} - 192 - German "Ö"-Umlaut
{SS},{GER_SS} - 219 - German "ß"-Umlaut
{AE},{UML_AE} - 222 - German "Ä"-Umlaut
{PIPE} - 226 - the "<"-Key, below the "a",
only on german keyboards.
Example
' Open Taskmanager
KYD.{LCTRL},{LSHIFT},{ESC}
PAU.0.01
KYU.{LCTRL},{LSHIFT},{ESC}
ENR.
' Open "File Open Dialog" in WordPad
STW.ct|WordPadClass|- WordPad
KYD.{STRG},"o"
KYD.{STRG},"o"
ENR.
' Internally the right ALT-Key also presses the left CTRL-Key.
KYD.{LCTRL},{RALT}
PAU.0.1
KYU.{LCTRL},{RALT}
ENR.
Remarks
-
Limitations:
You can not simulate {STRG},{RALT},{DELETE} to get the or you can call the Task-Manager like this Taskmanager:
' Open Taskmanager using Keyboard.
KYD.{LCTRL},{LSHIFT},{ESC}
PAU.0.01
KYU.{LCTRL},{LSHIFT},{ESC}
ENR.
See also:
• 1.9.1.6 Edit-Textbox Control
• RST. - Replace Selected Text