ctrx_<obj>_get_info

ctrx_button_get_info

ctrx_edit_get_info

ctrx_list_get_info

ExampleInformation Retrieval Functions

Gets class information about the object.

int ctrx_obj_get_info( const char *window_name, long xpos, long ypos, eObjAttribute attribute, char *value, [CONTINUE_ON_ERROR,] CTRX_LAST );

window_nameThe window title. NULL if not within an active window.
xposThe horizontal distance of the object from the edge of the application window, or ICA client window
yposThe vertical distance of the object from the edge of the application window, or ICA client window
attributeThe Object Attributes whose value is to be retrieved
valueAn output buffer for the retrieved value. object_value_buffer is allocated automatically. You may use any buffer, but you must declare and allocate memory in the script.
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.

The ctrx_<obj>_get_info family of functions assign the value of the attribute to the value buffer. ctrx_obj_get_info is a generic function that can be entered on any object identified as such by the recorder.

If an object is outlined in yellow in the snapshot in the tree view, then it has been recognized as an object. Right click on the outlined object, and choose Insert Object Get Info. The call will be inserted in the script.

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

ctrx_button_get_info gets information on command buttons.

ctrx_edit_get_info gets information on text boxes.

ctrx_list_get_info gets information on list boxes.

Return Values

Citrix ICA Return Values

Parameterization

All input string arguments (char type) can be parameterized using standard parameterization.

Example

To demonstrate the *get_info functions, use a simple Windows application:

InfoRetrieval_EXE() {
    long x, y, wd, ht;
    /* Run a program with a push button, text edit box, 
    single select list and multiple select list */

    /*Run the program*/
    ctrx_obj_mouse_click("<class=SysListView32>",
        258, 398, LEFT_BUTTON, 0, 
        "NULL=snapshot170", CTRX_LAST );

    ctrx_sync_on_window("Desktop", ACTIVATE, 
        0, 0, 801, 601, "snapshot171", CTRX_LAST );

    ctrx_obj_mouse_double_click("<class=SysListView32>", 
        259, 397, LEFT_BUTTON, 0, "Desktop=snapshot172", CTRX_LAST );

    ctrx_get_window_name(object_value_buffer, CTRX_LAST);

    // Output: ctrx_get_window_name: Desktop
    lr_message( "ctrx_get_window_name: %s",
        object_value_buffer );  

    ctrx_get_window_position("Form1", &x, &y, &wd, &ht, CTRX_LAST );

    // Output: Window position is 0, 0, 0, 0

    lr_message("Window position is %ld, %ld, %ld, %ld",
        x, y, wd, ht);

    /* The Command1 push button */

    ctrx_sync_on_window("Form1", ACTIVATE, 
        7, 7, 596, 256, "snapshot173", CTRX_LAST );

    // Confirm that the command button is in focus.

    ctrx_button_get_info("Form1",41, 39, 
        FOCUSED, object_value_buffer, CTRX_LAST );

    // Output: ctrx_button_get_info: TRUE

    lr_message( "ctrx_button_get_info: %s",
        object_value_buffer );

    /* Clicking the button displays the "Have a nice day" 
        message box */

    ctrx_obj_mouse_click(
	   "<text=Command1 class=ThunderRT6CommandButton>", 
	    41, 39, LEFT_BUTTON, 0, "Form1=snapshot174", CTRX_LAST );

    // The message box has focus, not the command button.

    ctrx_button_get_info("Form1",41, 39, 
        FOCUSED, object_value_buffer, CTRX_LAST );

    // Output: ctrx_button_get_info: FALSE

    lr_message( "ctrx_button_get_info: %s",
        object_value_buffer );

    /*Acknowledge the message box*/

    ctrx_sync_on_window("ObjectTest", 
        ACTIVATE, 302, 258, 171, 101, 
        "snapshot175", CTRX_LAST );

    // Get the message box title and position

    ctrx_get_window_name(object_value_buffer, CTRX_LAST );

    // Output: ctrx_get_window_name: ObjectTest

    lr_message( "ctrx_get_window_name: %s",
        object_value_buffer );

    ctrx_get_window_position("Form1", &x, &y, &wd, &ht, CTRX_LAST );

    // Output: Window position is 7, 7, 596, 256

    lr_message("Window position is %ld, %ld, %ld, %ld", 
        x, y, wd, ht);

    // Click OK to acknowledge the message box

    ctrx_obj_mouse_click("<text=OK class=Button>", 
        72, 71, LEFT_BUTTON, 0, 
        "ObjectTest=snapshot176", CTRX_LAST );

    /*Tab to text box Text1*/

    ctrx_sync_on_window("Form1", ACTIVATE, 
        7, 7, 596, 256, "snapshot177", CTRX_LAST );

    ctrx_obj_mouse_click(
        "<text=Form1 class=ThunderRT6FormDC>",
        233, 12, LEFT_BUTTON, 0, 
        "Form1=snapshot178", CTRX_LAST );

    ctrx_key("TAB_KEY", 0, CTRX_LAST );

    // Get the text

    ctrx_edit_get_info("Form1",6, 65,
        TEXT, object_value_buffer, CTRX_LAST );

    // Output: ctrx_edit_get_info: Text1

    lr_message( "ctrx_edit_get_info: %s",
        object_value_buffer );

    ctrx_sync_on_obj_info("Form1",
        6, 65, FOCUSED, "TRUE", CTRX_LAST );

    /*Change the text*/
    /* Select the text: mouse down at beginning, and up at end */

    ctrx_obj_mouse_down(
        "<text=Text1 class=ThunderRT6TextBox>",
        8, 71, LEFT_BUTTON, 0, 
        "Form1=snapshot179", CTRX_LAST );

    ctrx_obj_mouse_up(
        "<text=Text1 class=ThunderRT6TextBox>", 
        74, 72, LEFT_BUTTON, 0, 
        "Form1", CTRX_LAST );
    ctrx_type("T1");

    // Get the new text

    ctrx_edit_get_info("Form1",
        6, 65,TEXT, 
        object_value_buffer, CTRX_LAST );

    // Output: ctrx_edit_get_info: T1

    lr_message( "ctrx_edit_get_info: %s",
        object_value_buffer );

    /*Click title bar, then tab to Single Selection List*/

    ctrx_obj_mouse_click(
        "<text=Form1 class=ThunderRT6FormDC>", 
        191, 11, LEFT_BUTTON, 0, 
        "Form1=snapshot181", CTRX_LAST );

    ctrx_key("TAB_KEY", 0, CTRX_LAST);

    // How many lines in the list?

    ctrx_list_get_info("Form1",22, 89, 
        LINES, object_value_buffer, CTRX_LAST );

    // Output: ctrx_list_get_info: 7

    lr_message( "ctrx_list_get_info: %s", object_value_buffer );

    ctrx_sync_on_obj_info("Form1", 22, 89, 
        FOCUSED, "TRUE", CTRX_LAST );

    /*Select the 4th row of the list box */

    ctrx_obj_mouse_click("<class=ThunderRT6ListBox>", 
        44, 131, LEFT_BUTTON, 0, 
        "Form1=snapshot182", CTRX_LAST );

    // What item is selected?

    ctrx_list_get_info("Form1",22, 89, ITEM, object_value_buffer, CTRX_LAST );

    // Output: ctrx_list_get_info: Emma

    lr_message( "ctrx_list_get_info: %s", object_value_buffer );

    // Change the selection

    ctrx_list_select_item("Form1",22,89, "HENRY", CTRX_LAST );

    ctrx_list_get_info("Form1",22, 89, 
        ITEM, object_value_buffer, CTRX_LAST );

    // Output: ctrx_list_get_info: Henry

    lr_message( "ctrx_list_get_info: %s", object_value_buffer );

.......................
   return 0;
}