Keyboard
To work with the keyboard there is a built-in object "key" is used.
Let's take a sample code for working with the keyboard object. Paste the code, run it and select any text field.
After running the code you have only 5 seconds. Hurry up.
system.sleep(5000);
key.press('H');
key.release('H');
key.perform('E','PRESS');
key.perform('E','RELEASE');
key.type('L L O SPACE W O R L D');
This script generates events for pressing and releasing keyboard keys. It uses the basic available methods(press, release, preform, type). If more than one key is specified in the parameters, then the events for each key will be called sequentially one after another. So, the record
key.press('CONTROL A')
is equivalent to the
key.press('CONTROL');
key.press('A');
The type method generates successive press and release events for each key. So the line
key.type('H E L L O SPACE W O R L D');
The line sequentially generates events for text output hello world". Remember that the method
only generates the specified events, and does not actually print the text. key.type('hello
world) doesn't work, because to display of capital letters SHIFT or CAPS_LOCK
key press events are required, and the space is used to separate key names