Keyboard Typing Simulation

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Keyboard Typing Simulation >

Keyboard Typing Simulation

GKS. - Get Key-State

Previous Top Next


MiniRobotLanguage (MRL)

 

GKS. Command

Get Key-State

 

 

Intention

 

The GKS.-Command can be used to find out if a specified key on the keyboard is actually pressed or released. Unlike GEK., the GKS.-Command will return the state of the physical keyboard key, and tell you if its up or down (0/1).

 

GKS. has three modes of operation. In the first Mode, you can specify the button using all of the  Low-Level Keycodes see here:

Keyboard-Keycode-List.

 

In the second Mode, you can type a # followed by a decimal number or variable that contains the number. Like this:

 

' This will check the state of the left SHIFT-Key

GKS.#160|$$RES

DBP.$$RES

 

' This will get the state of the left SHIFT-Key

' You can omit the {} here if you want.

GKS.SHIFT|$$RES

DBP.$$RES

 

' This will get the state of the left SHIFT-Key

GKS.{SHIFT}|$$RES

DBP.$$RES

 

In the third Mode, you define the key directly, using "a" or "B". Here is an example:

 

' This will get the state of the a-Key

GKS."a"|$$RES

DBP.$$RES

 

 

You can read more about Keyboard-Simulation and Text-Boxes in the chapter:

1.9.1.6 Edit-Textbox Control

 

 

 

Syntax

 

GKS.P1[|P2]

 

 

Parameter Explanation

 

P1 - VAR or numeric, or Keycode see below.

 

P2 - (optional) Variable. If omitted TOS is used for result.

 

 

For P1, you can use all Low-Level-Keycodes: see here:

Keyboard-Keycode-List

 

 

 

Example

 

'*****************************************************

' EXAMPLE 1: GKS.

'*****************************************************

' Run this example from the editor and

' press the "a" button while its running

'

DOL.1

 GKS."A"|$$RES

 DBP.$$RES

 JNZ.$$RES|out

OOP.

:out

ENR.

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

    1.9.1.6 Edit-Textbox Control

    ! Keyboard-Keycode-List

    GEK. - Get Extended Key-State

    SEK. - Set Extended Key-State

    SKP. Send-Key-Press

    SKT. - Send-Key-Text

    KYD. - Key Down

    KYU. - Key Up

    RST. - Replace Selected Text

    SDT. - SenD-window-Text