vbscriptsendkeyscitrixxenapp

Citrix Xenapp - Sendkeys


I have been trying (with limited resources) to use VBScript and VBA commands to send keyboard functions to a remote citrix terminal. - This, as I've discovered is a known restriction and I've found various articles which give an alternative method via C++ and scancodes to overcome the restriction.

The main issue is, I don't have access to C++.

I've considered many options, including using the windows virtual keyboard (this didn't work) and installing a virtual keyboard driver in windows (well out of my depth).

Here is one of the articles which discuses the scancodes, using C++:

http://www.codeproject.com/Tips/310817/SendKeys-using-ScanCodes-to-Citrix

I am at a loss and anyone who can help would be a super hero...If a super heroes' main appeal was to be a geek god. :)

Any help is appreciated!!!

Cheers.

****UPDATE****

Hello,

I've done a little more digging...

...The Citrix ICA Client terminal window isn't receiving the VBScript sendkeys commands but if I manually press alt in the terminal after executing the script (with a 2 second pause), for example:

*Set objShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 2000
objShell.SendKeys ("e")
objShell.SendKeys "(P)"*

The above can access the 'file', 'edit', etc menu options on the tool bar within the terminal window.

This to me suggests that the issue isn't a privilege issue and I'd think that there is perhaps hope yet for the sendkeys method?

Having looked further into this, there is some documentation re: ini file settings on the Citrix site with regards to Citrix ICA clients.

One of the articles can be found below:

http://support.citrix.com/article/CTX129166

I've had a play around and there does seem to be a few ini files which list keyboard mappings, DLL files, virtual key passthrough as well?

One of the sections of the 'module' ini file contained the following:

[KeyboardLayout]
(User Profile)=0x00000000
(Server Default)=0xFFFFFFFF

There were other codes, including various languages, British, US-International etc.

This was then followed by a list of DLL codes e.g:

kbduk.dll=0x00000809

And finally, Language IDs, e.g:

eng=0x00000809

I am guessing (hoping) that there would be a way to amend the ini settings that will allow for the sendkeys to be received in the terminal fields and not just the toolbar menus.

As before, any help is appreciated....I am slowly going insane over this one!!!

Cheers!


Solution

  • Bullet pointed solution

    What is required:

    On screen keyboard (OSK.EXE) windows app VBScript (not essential but preferred by me as controling script) VBA (to move the mouse)

    1. Set OSK to receive 'hover' commands
    2. Set VBA code to move mouse to specific co-ordinates
    3. Use VBScript to control when specific subs from the VBA XLS file are run. - This can be set to run in the background without the requirement for manual opening of the file etc.
    4. Set Citrix Xenapp terminal as active window and key presses should send!

    Cheers all!