Example: ctrx_type

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);
lr_think_time(13);
ctrx_set_window("Document1 - Microsoft Word");

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

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