How to Trigger the Return Key or Enter Key?

I'm trying to program my mouse which is an MX 3 Master Logitech mouse for Mac to enter a hot key sequence upon the press of a button. The ultimate objective is to be able to click a button on the mouse and make the return key be pressed or enter key.

I can get the mouse to enter a hot key sequence no problem. But there is no option on their software to trigger the press of the return key.

So the next thing I thought of is setting up Keyboard Maestro to activate the return key via a hot key sequence that can be fired on my mouse.

I'm not sure of a simple way to do that and perhaps somebody can suggest one.

I did find this AppleScript that looks like it should do it.

tell application "System Events"
  key code 76 -- enter
  -- key code 36 --return
end tell

However, when I tried to set that up inside of keyboard maestro it tells me that, "to be executed, the macro must be enabled and active." And I guess I am not enabling it somehow and I'm not sure how to do it.

Ultimately, I simply want to click a button on my mouse and have it do the equivalent of me pushing the return key on my keyboard.

This would be handy if I have copy and pasted some text that I want to use for a search into the search bar of my browser and then just click a button to have the search begin. To do that, I have to be able to send the return key as if it were pressed on the keyboard.

Thanks for any pointers in the right direction.

I'm not sure if this will help, but have you tried the simplest thing.


@Frankb posted a good alternative to using AppleScript.

But in addition to that, make sure that the macro you are creating is in a macro group that is active and enabled. Active generally means it’s not limited to any particular application or window, and enabled generally means the macro group is not disabled, nor is the macro itself disabled (greyed out).

Beyond that, if possible, post the macro itself so we can take a look at it and see what might be going wrong. As one of the moderators likes to say, "If we're not testing we're guessing, and guessing often wastes people's valuable time". :laughing: If you need help on how to post the macro, just let us know and we can walk you through it.

If you haven’t had the opportunity to read this tutorial, I highly recommend it. It will help you get the most help for your question.

Tip: How Do I Get The Best Answer in the Shortest Time?



You sure about that? Have you tried Keystroke Assignment in Logi Options?

1 Like

@Frankib That worked and very nicely.

I was looking in the wrong category for this. And yes it is certainly a simple solution and exactly what I was looking for. Thank you.

@cdthomer thank you for your help. And I will definitely go through that link tutorial.

@noisneil I have looked numerous times. And today finally contacted their tech-support which was a waste of time. It sure seems like it should do it. But there is nothing that says return or enter. I even saw a tutorial that showed that it should work. But I could not find it on my software or with my configuration anyway. I'm using an MX keys for Mac, Logitech keyboard. Logi Options+ software.

I have an original MX Master, so you may be on the newer version of Logi Options. However, I'd imagine the setup would be very similar if not identical in terms of possibilities.

Well I don't know why I didn't think about this either… But I did just go and attempt to assign a keystroke. I could do it easily. I was looking for something that said return or enter. And that doesn't exist. But I was able to assign that keystroke by simply entering the box and clicking it.

Thanks for following up.

1 Like