CitrixConnect Function

Action

Establishes a connection to a Citrix MetaFrame server, or server farm, using standard login credentials. If the connection targets a published application, CitrixSetApplication should be called before CitrixConnect.

Include file

CitrixAPI.bdh

Syntax

CitrixConnect( in sServer   : string,
               in sUser     : string optional,
               in sPassword : string optional,
               in sDomain   : string optional,
               in nColor    : number optional ) : boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sServer Name of the target server.
sUser Username for login (optional)
sPassword Password for login (optional)
sDomain Domain for login (optional)
nColor

Color depth of the remote session. When scripts contain a screen synchronization function (CitrixWaitForScreen), it is necessary that replay color depth be identical to that used during recording. Specify one of the following values:

  • COLOR_16: 16 colors

  • COLOR_256: 256 colors

  • COLOR_16bit: 65536 colors

  • COLOR_24bit: 24 bit color value (16M)

  • COLOR_32bit: 32 bit color value (4G)

Example:

dcltrans
  transaction TMain
  var
  begin
    CitrixInit(640, 480);
    CitrixConnect("server1", "username", "password", "companydomain", COLOR_16bit);
    CitrixWaitForLogon();
    hWnd4 := CitrixWaitForWindowCreation("", MATCH_Exact, 0x96840000, -2, 452, 644, 30);
    hWnd5 := CitrixWaitForWindowCreation("ICA Seamless Host Agent", MATCH_Exact, 0x94C800C4, 0, 0,390, 223);
    CitrixWaitForWindow(hWnd5, EVENT_Activate);
    CitrixWaitForWindowCreation("Program Manager");
    ThinkTime(31.50);
    CitrixMouseClick(217, 192, hWnd5, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd5, EVENT_Destroy);    
    CitrixDisconnect();
end TMain;