CitrixGetSessionString Function

Action

Returns the session string of the current ICA session from the server. The string that is returned is specified by the nIndex value.

Include file

CitrixAPI.bdh

Syntax

CitrixGetSessionString( in  nIndex  : number,
                        out sString : string ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
nIndex

Specifies one of the following values:

  • 0: Returns the server name.

  • 1: Returns the user name

  • 2: Returns the domain

sString Retrieves the specified value.

Example:

  transaction TMain
  var
    sSession   : string;
  begin
    CitrixInit(640, 480);
    CitrixSetApplication("Excel");
    CitrixConnect("myserver", "myusername", "mypass", "mydomain", COLOR_16bit);
    CitrixWaitForLogon();
    hWnd4 := CitrixWaitForWindowCreation("Microsoft Excel - Book*", MATCH_Wildcard, 0x15CF0000, -4, -4, 648, 488);
    CitrixKeyString("test");
    CitrixMouseClick(636, 14, hWnd4, MOUSE_ButtonLeft);
    ThinkTime(2.63);
    CitrixMouseClick(306, 289, hWnd4, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd4, EVENT_Destroy);
    CitrixGetSessionString(0, sSession);
    print("Citrix host name: " + sSession);
    CitrixGetSessionString(1, sSession);
    print("Citrix user name: " + sSession);
    CitrixGetSessionString(2, sSession);
    print("Citrix domain: " + sSession);
    CitrixDisconnect();
  end TMain;