Send mouse key + keyboard modifier?

Hi,

I’m trying to let my UHK (v2) send a (left) ctrl + right mouse button click.

My current macro looks like this:

pressKey LC-
pressKey mouseBtnRight
releaseKey LC-

But this doesn’t seem to do it (I have an app that shows a context menu on its toolbar buttons with such a click).

Is the macro wrong or what am I missing here?

Scancodes and mouse actions are reported over different USB interfaces, so if they are sent in a rapid sequence, the computer/program may receive them in wrong order.

Solution is to add some delays between the commands. E.g.:

pressKey LC-
delayUntil 50
pressKey mouseBtnRight
delayUntil 50
releaseKey LC-

This can also be done globally by setting set keystrokeDelay 10 in your $onInit macro. (Careful with this as keystrokeDelay may cause significant latency with too high values.)

Thank you @kareltucek !

1 Like

@highend I would like to ask you for more information on this. You can read more on reasons for asking these questions here: Feedback needed: key timing, latency, delays, although reading it is by no means necessary.

  • What OS are you using?
  • Can you please test the following version of the macro with various keystrokeDelay values and let me know which is the lowest value that produces reliable results?
set keystrokeDelay 10
pressKey LC-
pressKey mouseBtnRight
releaseKey LC-

Hi @kareltucek

Sorry, I didn’t get an e-mail about a new post in this thread…

I’d really like to help out but I’m afraid I unable to do so.
I’ve switched from Windows to Mac (Ventura is currently installed).
I only have Windows as virtualized machines on Proxmox now and things like sending a keyboard modifier like CTRL doesn’t really work via the RDP connection so I’m using an .ahk script on the VM that looks for a specific key press (and I let my UHK send F13… for this).

Sorry!