Share this page

# ctrx_mouse_down

Example | Mouse functions

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

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

`int ctrx_obj_mouse_down( 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 down click from the edge of the ICA client window.
y_pos | The vertical distance of the mouse down click from the edge of the ICA client window.
mouse_button | Mouse Key Values.
key_modifier | Key Modifier Values that were pressed together with the mouse_button.
window_name | The title of the window in which the double mouse click occurs. NULL if not within an active window.
CONTINUE_ON_ERROR | A constant, entered as shown without quotes. Overrides the error behavior runtime setting for this step so that script behaves as though the runtime setting was Continue on error.
CTRX_LAST | A marker that indicates the end of the argument list.

ctrx_mouse_down waits for the window window_name to appear, then executes the mouse down.

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

If the mouse down 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 screen.

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

## Return Values

Citrix ICA Return Values

## Parameterization

No parameterization is available for this function.

## Example

In the following example, after connecting to the Citrix server ludens, Microsoft's Word application is launched and some text is typed into the new document. The text is then highlighted, ctrx_mouse_down is invoked at the beginning of the text, and ctrx_mouse_up is recorded when the cursor has been drawn across the entire string.

    Actions () {

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

         /* Double click on Microsoft Word icon */
         ctrx_mouse_double_click(37, 243, LEFT_BUTTON, 0, NULL, CTRX_LAST);

         ctrx_set_window("Document1 - Microsoft Word", CTRX_LAST); /* wait for Word to appear */
         ctrx_type("This is a test ", CTRX_LAST);

         /* Highlight "This is a test" with the mouse */
         ctrx_mouse_down(29, 138, LEFT_BUTTON, 0, "Document1 - Microsoft Word", CTRX_LAST);
         ctrx_mouse_up(117, 137, LEFT_BUTTON, 0, "Document1 - Microsoft Word", CTRX_LAST);

         lr_think_time(6);
         ctrx_key("DELETE_KEY", 0, CTRX_LAST); /* delete text */
         lr_think_time(3);

         /* Exit Word */
         ctrx_mouse_click(24, 39, LEFT_BUTTON, 0, "Document2 - Microsoft Word", CTRX_LAST);
         ctrx_set_window("Microsoft Word", CTRX_LAST); /* The "Do you want to save" dialog */
         /* Click on don't save */
         ctrx_mouse_click(44, 217, LEFT_BUTTON, 0, "Microsoft Word", CTRX_LAST);

         /* Wait for Word to exit */
         ctrx_unset_window("Document1 - Microsoft Word", CTRX_LAST);
         lr_think_time(2);
         ctrx_disconnect_server("ludens", CTRX_LAST);

         return 0;
    }

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