Share this page

# ctrx_key

Keyboard Functions

Emulates a non-alphanumeric key press on a Citrix client sent to a Citrix server.

`int ctrx_key( char *key, long int key_modifier, [filename,] CTRX_LAST );`

key | The name of the non-alphanumeric key, such as "END_KEY". See the Key Codes for a list of the available keys.
key_modifier | Key Modifier Values that were pressed together with key.
filename | The name of the bitmap file containing a screen shot of the window. This file is located in the script directory under data/bitmap/.
CTRX_LAST | A marker that indicates the end of the argument list.

ctrx_key emulates a user pressing a non-alphanumeric key on a Citrix client.

## Return Values

Citrix ICA Return Values

## Parameterization

Parameterization is available for all arguments of this function.

## Example

In the following example, the user starts the Microsoft Word application. Various key activities are recorded including calls to ctrx_key. To save the application, the user presses the Ctrl–S combination. This registers in ctrx_key as key "s" with "MODIF_CONTROL" as the key_modifier.

Copy code

    /* Run the Microsoft Word application by clicking icon on desktop */

    ctrx_mouse_double_click(34, 325, LEFT_BUTTON, 0, NULL, CTRX_LAST);
    lr_think_time(13);
    ctrx_set_window("Document1 - Microsoft Word", CTRX_LAST);
    ctrx_type("This is the start of a new MS Word document", CTRX_LAST);
    ctrx_key("HOME_KEY", 0); /* Go to the beginning of the line */
    ctrx_key("1", MODIF_NUMPAD, CTRX_LAST);   /* Emulates pressing "1"  on the number pad*/
    ctrx_key("1", NO_MODIF, CTRX_LAST);   /* Emulates pressing "1"  on keyboard above the "Q" key */
    ctrx_key("END_KEY", 0, CTRX_LAST); /* Go to the end of the line */
    ctrx_key("ENTER_KEY", 0, CTRX_LAST); /* Start a new line with a line feed */
    ctrx_type("This is a new line", CTRX_LAST);
    ctrx_key("UP_ARROW_KEY", 0, CTRX_LAST); /* Go up to the previous line */
    /* Now save document with Ctrl-S */ctrx_key("s", MODIF_CONTROL, CTRX_LAST);
    lr_think_time(6);
    ctrx_set_window("Save As", CTRX_LAST);
    /* save as the default name which MS Word provides */
    ctrx_mouse_click(604, 392, LEFT_BUTTON, 0, "Save As", CTRX_LAST);
    /* Exit Word application */
    ctrx_mouse_click(573, 61, LEFT_BUTTON, 0,
        "Document1 - Microsoft Word", CTRX_LAST);

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: