KM not sending hotkey to Parallels anymore [solved]

I have a simple script to start a scan in Windows/VueScan under Parallels. It basically just activates the VM window, and sends a CONTROL-N key command.

It's been working for ages, until I upgraded El Cap -> Sierra and also upgraded Parallels. Now, pressing CONTROL-N manually in the VM window works, but when KM sends the key command, nothing happens. It's like KM can no longer send any key commands to Parallels.

  • Semaphore Lock “VS Win Scan”
  • Activate VueScan
  • Pause for 0.5 Seconds
  • Type the ⌃N Keystroke
  • Pause for 2 Seconds
  • Semaphore Unlock “VS Win Scan”

I've tried various combinations of activating windows, sending the keypress directly to different windows, but nothing. This was bulletproof previously, so I'm not sure what's going on...!

I've reset all the accessibility stuff as advised in another thread, but still the same behaviour...

Edit: Ok, sort of found out what's happening. KM is sending key strokes to the VM, and it works ok in other Mac VM's. With my Win7 VM, keystrokes are behaving weirdly.

Now, Parallels has a feature that can translate between Mac & Windows key strokes, but whatever I do, when I send a ^n or #n in KM, Win gets an "n", no modifier. I've tried all kinds of translation options and mappings, none of them work when being sent from KM. Keystrokes behave normally when typed directly in the VM.

Edit2: Ok. In Parallels -> macOS System Shortcuts, the option to "Send macOS system shortcuts" must be set to "Always". Otherwise, it doesn't interpret modifier keys correctly at all - any other option results in weird behaviour (I've found other people who've come across this - it looks like a control-N gets interpreted as a control press, control release, then a n press, and n release, rather than simultaneous presses - and this corresponds to the behaviour I've seen. Goodness knows why this happens, it makes no sense to behave like this!)

So I'll leave this here in case anyone else is struggling with sending modifier keys from KM to Parallels correctly.