ExampleConnection Functions

Connects to a Citrix server via an NFUSE portal.

int ctrx_nfuse_connect( char *url , [CONTINUE_ON_ERROR,] CTRX_LAST );


The NFUSE ICA file's resource url.

Note: If the machine that hosts the Citrix server (Citrix Virtual Apps and Desktop) is associated with a CNAME/alias, make sure that the url argument receives the hostname used by the Citrix server.

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_nfuse_connect establishes a connection with the Citrix server using the NFUSE application portal. Specifications found in the ICA file defining the personalized specifications of the NFUSE portal are downloaded from the server, after which the connection is made.

ctrx_nfuse_connect is automatically generated by VuGen when recording an NFUSE session.

Note: Before recording NFUSE sessions, you must enable multi-protocol recording. See "About Creating Citrix Vuser Scripts" in the Virtual User Generator Help Center (select the relevant version).

Return Values

Citrix ICA Return Values


No parameterization is available for this function.


The following example uses ctrx_nfuse_connect to establish a connection to the Citrix server. After filling in the login information at the NFUSE portal, ctrx_nfuse_connect is automatically generated by VuGen to retrieve information from the server (found in the ICA file) on applications available to the client. In this case, Microsoft's Excel application is configured to launch automatically.

After ctrx_nfuse_connect connects to the server, the code waits for the Excel window to appear before continuing the session.

vuser_init () {

     /* Use browser to connect to NFUSE portal */
          "URL=http://concept1.mycomp.com:8080/login.asp", LAST );

     /* Send login information */
          "Method=POST", "EncType=application/x–www–form–urlencoded",
          "Name=user", "Value=test", ENDITEM,
          "Name=password", "Value=test", ENDITEM,
          "Name=loginPage", "Value=default", ENDITEM,
          "Name=domain", "Value=ludens", ENDITEM,
          "Name=logIn.x", "Value=46", ENDITEM,
          "Name=logIn.y", "Value=14", ENDITEM, LAST );

          "URL=http://concept1.mycomp.com:8080/blank.htm", LAST );
          "URL=http://concept1.mycomp.com:8080/applist.asp\?NFuse_currentFolder=", LAST );

     /* Connect to Citrix server - this is automatically generated by VuGen */
     ctrx_nfuse_connect("http://concept1.mycomp.com:8080/launch.asp\?NFuse_Application=Ex0078cel&NFuse_MIMEExtension=.ica", CTRX_LAST);


     /* Now wait for Excel application defined in NFUSE ICA file */
     ctrx_set_window("Microsoft Excel", CTRX_LAST);
     ctrx_mouse_click(249, 32, LEFT_BUTTON, 0, "Microsoft Excel", CTRX_LAST);
     ctrx_mouse_click(508, 80, LEFT_BUTTON, 0, "Microsoft Excel", CTRX_LAST);
     ctrx_set_window("Microsoft Excel_2", CTRX_LAST);
     ctrx_mouse_click(416, 356, LEFT_BUTTON, 0, "Microsoft Excel", CTRX_LAST);
     ctrx_unset_window("Microsoft Excel_2", CTRX_LAST);
     ctrx_mouse_click(158, 570, LEFT_BUTTON, 0, "Microsoft Excel", CTRX_LAST);

     ctrx_disconnect_server("", CTRX_LAST);

     return 0;