CitrixKeyString Function

Action

Types the specified string into the window that has keyboard focus.

Include file

CitrixAPI.bdh

Syntax

CitrixKeyString( in sInput : string ) : boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sInput String to type.

Example:

  transaction TMain
  var
  begin
    CitrixInit(640, 480);
    CitrixConnect("myserver", "myusername", "mypass", "mydomain", COLOR_16bit);
    CitrixWaitForLogon();
    hWnd6 := CitrixWaitForWindowCreation("ICA Seamless Host Agent", MATCH_Exact, 0x94C800C4, 0, 0, 390, 223);
    CitrixWaitForWindow(hWnd6, EVENT_Activate);
    CitrixWaitForWindowCreation("Program Manager");
    ThinkTime(8.25);
    CitrixMouseClick(219, 195, hWnd6, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd6, EVENT_Destroy);
    CitrixMouseDblClick(113, 20, DESKTOP, MOUSE_ButtonLeft);
    hWnd10 := CitrixWaitForWindowCreation("Microsoft Excel", MATCH_Exact, 0x15CF0000, -4, -4, 648, 460);
    CitrixWaitForWindow(hWnd10, EVENT_Activate);
    CitrixWaitForWindow(hWnd10, EVENT_CaptionChange, "Microsoft Excel - Book1", MATCH_Exact);
    CitrixKeyString("field1");
    CitrixKey(KEY_Enter);
    CitrixKeyString("field2");
    CitrixKey(KEY_Enter, MOD_None, 3);
    CitrixKeyString("a");
    CitrixKey(KEY_Enter);
    CitrixKey(65, MOD_Ctrl); // 'a' 
    CitrixMouseClick(630, 13, hWnd10, MOUSE_ButtonLeft);
    hWnd11 := CitrixWaitForWindowCreation("Microsoft Excel", MATCH_Exact, 0x94C801C5, 149, 206, 350, 108);
    CitrixWaitForWindow(hWnd11, EVENT_Activate);
    CitrixMouseClick(186, 85, hWnd11, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd11, EVENT_Destroy);
    CitrixWaitForWindow(hWnd10, EVENT_Destroy);
    CitrixDisconnect();
  end TMain;