Example: ctrx_key

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.

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

ctrx_mouse_double_click(34, 325, LEFT_BUTTON, 0, NULL);
lr_think_time(13);
ctrx_set_window("Document1 - Microsoft Word");
ctrx_type("This is the start of a new MS Word document");
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); /* Go to the end of the line */
ctrx_key("ENTER_KEY", 0); /* Start a new line with a line feed */
ctrx_type("This is a new line");
ctrx_key("UP_ARROW_KEY", 0); /* Go up to the previous line */
/* Now save document with Ctrl-S */ctrx_key("s", MODIF_CONTROL);
lr_think_time(6);
ctrx_set_window("Save As");
/* save as the default name which MS Word provides */
ctrx_mouse_click(604, 392, LEFT_BUTTON, 0, "Save As"); 
/* Exit Word application */
ctrx_mouse_click(573, 61, LEFT_BUTTON, 0, 
    "Document1 - Microsoft Word");