ctrx_mouse_click

Example Mouse Functions

Emulates a mouse click on a Citrix client sent to a Citrix server.

int ctrx_mouse_click( long x_pos, long y_pos, long mouse_button, long key_modifier, char *window_name, [CONTINUE_ON_ERROR,] CTRX_LAST );

int ctrx_obj_mouse_click( const char *obj_desc, long x_pos, long y_pos, long mouse_button, long key_modifier, char *window_name, [CONTINUE_ON_ERROR,] CTRX_LAST );

obj_desc A description of the object recorded if the agent is installed on the server.
x_pos The horizontal distance of the mouse click from the edge of the active window.
y_pos The vertical distance of the mouse click from the edge of the active window.
mouse_button Mouse Key Values.
key_modifier Key Modifier Values.
window_name The title of the window in which the mouse click occurs. NULL if not within an active window.
CONTINUE_ON_ERROR A constant, entered as shown without quotes. Overrides the error behavior run-time setting for this step so that script behaves as though the run-time setting was Continue on error.
CTRX_LAST A marker that indicates the end of the argument list.

ctrx_mouse_click waits for window window_name to appear, then executes the mouse click.

If the agent is installed on the server, ctrx_obj_mouse_click is recorded. The only difference is the additional object description.

If the mouse click occurs on the desktop (i.e., not within a window), then x_pos and y_pos will hold values relative to the edge of the ICA client window. If the mouse click occurs on the desktop, window_name is NULL.

The wildcard character (*) can be used in window_name.

Limitation in Windows 8.1

On Windows 8.1, a click on the Start button does not display the Start menu. When clicking on the Start Button, add a second ctrx_mouse_click or ctrx_obj_mouse_click to the script below the recorded click.

Return Values

Citrix ICA Return Values

Parameterization

No parameterization is available for this function.

Example

In the following example, after connecting to the server ludens and opening Microsoft's Internet Explorer application, the function ctrx_mouse_click clicks the "exit" window checkbox of Internet Explorer.

Actions () {

     ctrx_connect_server("ludens", "test", "test", "ludens", CTRX_LAST);
     ctrx_wait_for_event("LOGON");

     /* Launch the web browser by clicking on desktop IE icon */
     ctrx_mouse_double_click(34, 325, LEFT_BUTTON, 0, NULL, CTRX_LAST);
     lr_think_time(13);
     ctrx_set_window("Welcome to MSN.com - Microsoft Internet Explorer", CTRX_LAST);

     /* Exit the web browser by clicking on top left Exit check box */
     ctrx_mouse_click(573, 61, LEFT_BUTTON, 0,
               "Welcome to MSN.com - Microsoft Internet Explorer", CTRX_LAST);
     lr_think_time(12);
     ctrx_disconnect_server("ludens", CTRX_LAST);

     return 0;
}