KM and Force Pasting

I'm having quite a tricky time getting KM to do force pasting of the clipboard. IE paste by emulated typing.

I used to use:
Force Paste - Typing.kmmacros (1.6 KB)

Which works for a lot of uses

But now i want to use it with MS RDP Client. If i use the macro above, it will not type any symbol characters. for example, instead of % I end up with 5, weird but ok.

I know of another app, Force Paste. If i install that and click it in the dock, works fine.

But I want a hotkey. So can i trigger this app with a hotkey from KM?
Force Paste - App.kmmacros (1.8 KB)

I can trigger it, but it doesnt work. I just get a dialog:

Clicking run doesn't do anything.

Ok, well, Force Paste is just a compiled applescript, so lets just try that directly

Force Paste - Script.kmmacros (2.1 KB)

This kinda sorta works, in TexEdit, it pasted everything except the first char. From then on out it went weird and started triggering screenshots, mission control things, all kinds of nonsense. I have no idea whats going on there. If i do it in MS RDP Client, it seems to be okay?

So whats going on with all these? whats different about clicking the app in the dock and triggering it with KM? why doesnt the script behave like it does in the App? Why does the normal solution seem to eat symbols and not output the clipboard unmolested?

Because software events (KM typing for you) are not hardware events (you mashing the keyboard), and it's up to the "receiving" software how (or even if!) it deals with them. This seems a particular issue with apps used to interact with remote or virtual machines (see recent threads about Apple Remote Desktop, Parallels and Windows VMs, etc) where you often have a "translation" layer as well. It's often the meta keys that are the problem -- in RDP's case, that includes "Shift".

Using "System Events" and keystrokes can sometimes get round this -- they seem to work at a level somewhere between hardware and software events -- but not always. Often you just have to try and see what happens...

Yes, I understand that these are not real hardware events. I would have thought that by the time an app sees a keystroke its interpreted by the system. ie app gets % not Shift, 5. But thats an assumption on my part.

I think my main confusion is around why running an app does not behave the same as running the app from the dock, or why the script in the app works, but does not work from KM.