ctrx_type

ExampleKeyboard Functions

Emulates typing alphanumeric keys.

int ctrx_type( char *data, [filename,] CTRX_LAST );

dataThe alphanumeric key presses
filenameThe 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.

The function ctrx_type emulates a user typing alphanumeric characters.

During recording, alphanumeric key presses are recorded until some other type of keyboard activity, such as mouse clicks or non-alphanumeric key presses.

Note: When typing is slow, VuGen may break up a typing session into successive invocations of ctrx_type. By manually editing the script, these calls can be concatenated. This will enable easier parameterization if you require the string to be substituted with a parameter.

Return Values

Citrix ICA Return Values

Parameterization

Parameterization is available for all arguments of this function.

Example

In the following example, theuser starts the Microsoft Word application. When the user types the document, key activity is recorded by ctrx_type. To save the application the user presses the Ctrl–S combination, which is recorded by ctrx_key.

/* 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);

/* 2 calls to ctrx_type were recorded because of slow typing. They can
    be concatenated manually to facilitate parameterization 
    i.e., ctrx_type("This is the start of a new document"); */

ctrx_type("This is the start of", CTRX_LAST);
ctrx_type("a new document", CTRX_LAST);
ctrx_key("HOME_KEY", 0, CTRX_LAST); /* Go to the beginning of the line */
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 MS Word provides */
ctrx_mouse_click(604, 392, LEFT_BUTTON, 0,
    "Document1 - Microsoft Word", CTRX_LAST); 

/* Exit Word application */
ctrx_mouse_click(573, 61, LEFT_BUTTON, 0,
    "Document1 - Microsoft Word", CTRX_LAST);