Types a specified key. The window that has keyboard focus receives the key-stroke event. Key modifiers (such as Shift and Alt) can be provided. The third parameter specifies how often the key is to be pressed. Timing parameters (such as key down-time and repeat-delay) can be specified in profile settings (Citrix / Simulation / Keyboard) or by an appropriate call to the CitrixSetOption function.
CitrixAPI.bdh
CitrixKey( in nKey : number, in nModifier : number optional, in nRepeat : number optional ) : boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
nKey |
The key to type. Use a key number (ASCII code) or one of these predefined values:
See the CitrixApi.bdh for additional predefined values. |
nModifier |
Specify one of the following values (optional):
To use more than one key modifier, combine the modifiers with the "|" symbol, For example, to type the key "Ctrl-Shift-X", use the following syntax: CitrixKey(88, MOD_Ctrl | MOD_Shift); |
nRepeat | Repeat count of key strokes (optional). When this parameter is omitted the key is pressed once. |
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;