Losing modifier keys (sort of) w/ Citrix client - types 8 instead of *

I've been using KM with Citrix Workspace, logging into a remote Windows virtual PC located in my office network. My Citrix setup works fine, connectivity-wise. I have good bandwidth and reasonable latency.

Whenever I use KM to simulate typing strings that I type often, when the string contains a character that is normally obtained using the SHIFT key, the SHIFT key seems to get lost and I get the unshifted character instead. E.g. I want to simulate the asterisk, but get the digit 8, instead. This happens often, but not all the time, and if I trigger the macro twice in quick succession, the second invocation often does not lose the modifier key.

I've played with setting keystroke delays and was hopeful that would help, but it does not.

I have this problem only with Citrix remote desktops, never locally.

Does anyone have any idea how to fix this?

This sounds vaguely familiar, but I might be wrong. Have you tried searching this forum for "Citrix"?

Yes. "Citrix" yields a bunch of posts, but none seems relevant (unless I missed something).

To illustrate, I have a macro that types "SELECT * FROM " (pasting doesn't work, because of some weirdness between the Citrix client and Mac OS, and also because I don't want to clobber my clipboard).

If I execute the macro 4 times, here is what I get each time:

SelECt 8 fRom 
SElect 8 from 
SELecT * FRom 
SeLeCT 8 from 

Seems totally random.

Looks like KM is typing too fast for the app/Citrix client.
You can either break the typed text into smaller chunks with possibly a 0.05 sec delay between each chunk

or I am sure there is a config param that sets the overall KM typing speed.
I cannot find it but it should be in


Maybe someone else can find it....

@jonathonl - I searched through that page and didn't find anything that looks like typing speed.

I should mention that I've tried using the KM "Set Simulate Normal Keystroke Delay" action. In the example above, the delay is 0.5s (meaning half a second for each keystroke!). I've tried a variety of delays. I've also tried splitting up the string into multiple sections. It doesn't make any difference. :frowning:

I've tried using an AppleScript action like this:

tell application "System Events" to keystroke "*"

and even like this:

set texttowrite to "_PF_vw_"
tell application "System Events"
	repeat with i from 1 to count characters of texttowrite
		delay 0.04
		keystroke (character i of texttowrite)
	end repeat
end tell

These work better, but I still get the same random errors from time to time.

It sounds like Citirx is not handling the keyboard events in order, or not dealing with the speed of the events coming in, or has some level of asynchronicity in its handling of the modifier keys.

Keyboard Maestro has timing controls to control how long the key is held down for, and how long after it is released before the next key will happen, but it does not have controls for how long between each modifier key press or how long between the modifier key press and the actual key press.

You can try things like:

It is more than a little tedious, but it might work for specific cases and would confirm whether timing is the issue.

Keyboard Maestro is simulating the sequence of events, but unfortunately not all apps, especially cross platform, virtual machine, or remote desktop apps may not process the events correctly and I can't really control that.

You should complain to the Citrix developers of the failure, though I doubt you'll get much os a result from that, but maybe you will.

1 Like

I didn't know about the Type Modifier or Pause actions. This does seem to make a difference. It's still not perfect, but I'm experimenting with the timing. It works better than the Delay action.

I'm only beginning to realize how much KM can do... is there a tutorial or cookbook area where I can learn more about programming it?

Thank you!

Look through the wiki - specifically, look through the various sections:

  • Triggers - all the different ways to start a macro.
  • Actions - all the things you can do natively (after that there are all the scriptable things too).
  • Conditions - all the things you can test for.
  • Tokens - all the data you can get.
  • Functions - as well as numeric data.

Skimming through that is worthwhile to at least get an overview of what is possible.