Simulate Multiple Arrow Keystroke

Hi there,

I am trying to simulate 2x arrow keystokes at once with shift key. Can anyone suggest work around?



There's a Repeat action. Add that to your macro, set it to repeat twice, then put the Press a Keystroke action inside the repeat action.

Or is that not what you're trying to do?



If you want more than 2, you could wrap the action in a Repeat action, but that would seem unnecessarily complicated for two key presses.

Thanks guys, I made an error in my query.

I should have said within the Hot Key Trigger.

Is that possible? E.g. Command + Shift + Left Arrow + Up Arrow

So you want the hot key trigger to be Command + Shift + Left Arrow + Up Arrow, yes? No, that's not possible within KM since Left Arrow and Up Arrow are two keystrokes and hitting them together doesn't make sense at the usual level of operating a Mac.

A lower-level solution would be possible (perhaps using Karabiner Elements and certainly if you had a programmable keyboard) but there are so many permutations offered by modifier keys + a single keystroke that it would be simpler just to choose a single keystroke.

As far as I know, as soon as you type a "normal" key as part of a hot key trigger, those keys are then processed by the OS, which decides if it's supposed to do anything with them, and if not, then other apps that watch for keystrokes have them.

Perhaps if you told us what you're trying to accomplish with that trigger, we could come up with another way of solving the problem.


"Not possible?" It's possible, but it's not a good use of CPU. For example, you could run this code in a continual loop:


A "purist" would not want to recommend inefficient code like this, but I'm a "pragmatist." If a person wants to put their CPU in an infinite loop, I'm okay with that. It's bad code, from a purist's perspective, but it does the job. It should be up to the person who asked the question whether they want to use bad code or not. Maybe they are fine with it.

I'm 100% okay with creating "polling" code. I do it all the time, and I have never broken my Mac doing it.

I don't think there's anything wrong with it in general either. However, if you do this, it's a good idea to keep an eye on CPU usage, just to make sure you understand the impact it may have.

I've done some testing in the past for a polling macro I wanted to run, and just one constantly-active macro takes 10% of my Mac's CPU (as seen in Activity Monitor for Keyboard Maestro). That's not necessarily a lot or a little, but it's enough that you should be aware of the impact if you need to run many such macros.

If you do need many, it's probably best to combine them into one as best as possible: Just one constantly-running macro, and then have it execute other macros based on key presses or whatever conditions. This should, in theory, be more efficient than five separate always-running macros.


It's nice that KM can flex like that, but that's not a hot key trigger, which is what the rephrased question, and my restating of it, specified. Sticking to the standard usage of the term may seem, as you would say, purist – but I think the bottom line remains that KM does not offer this mechanism as a hot key trigger and there is no obvious need for an alternative approach when so many permutations of hot keys are available.

Okay, but you are trying to change the user's solution. I was trying to give the user exactly what he requested (at least as I understood it.)

Half the time users are asking for the wrong thing, but that shouldn't stop us from giving them the solution that they ask for.

Rather than using two different arrows ie Left and Up
you could you use say Left Arrow with LONG PRESS option

I think the Wiki covers this by cautioning on the Forum page "Avoid the XY Problem of asking about your attempted ​solution​ rather than your actual problem". But I appreciate that your outlook is different from mine in some ways and I suppose we shouldn't get heavily into debating philosophical niceties in this thread. :wink: