"Space" is "Enter" if an image is visible

Once again, I'm reaching my limits.

Here is what I would like to do.

If (on the main screen) a certain image is visible, then

"space" becomes "enter".

if not

"space" and "enter" remain what they are.

Thanks for your help!

As long as you don't mind the macro triggering every time you hit Space in that app,

If image found
Then simulate keystroke Enter
Else simulate keystroke Space

It is not an app it is a context menu. There you see this image and after pressing "space" the menu disappears again.

Sorry @Nige_S I do not know how to do this. Can you help, please?

Which app is the context menu in? KM can't trigger a macro when a context menu becomes visible, so I still think it's a case of simulating keystrokes.

1 Like

Mmm, not sure which app... The menu is configured in BTT, but it is a normal macOS context menu.

To explain in more detail. In a macOS context menu (control + left click) you can trigger a selected menu item with enter or with space. But for me it only works with the Enter key, so I want Space to be Enter when this menu is open.

Normally "Alias..." is triggered with Enter or space. But with me only enter works. Therefore, space should be enter when an image is visible.


This is a part of this menu and the image is the Mastercard icon. I want to press "m" and space to trigger MASTER.


From your description lower down, it sounds like you aren't going to see a single image but one out of many potential images. Constantly screen-scraping for all those potentials, just in case, is going to kill your machine.

It'll be quicker to find out why Space isn't working for the selection!

If you specifically want to "Make Alias", just use ⌃⌘A. But I'm betting that aren't actually in the Finder, you're in another app, and that's why you can't use Space. What's the app?

Unfortunately not even Apple support knows this. Space unfortunately does not work in any app, not even in the Finder, although it should work. Only Enter works.

In the worst case I just stay with enter, but space would be much more convenient.

Hey Frank,

The way I'd handle this is to create a type-a-keystroke macro that uses Ctrl-Space or something similar to press the Enter key.

That way I get want I want without causing undue problems for myself everywhere.


Thanks Chris, but I'm afraid I don't understand exactly what you mean. Could you post an example so I can try it out?

Something like this:

Type Enter.kmmacros (1.6 KB)
Keyboard Maestro Export

This way you get your keystroke, but you don't bog down the system.

Set trigger to Ctrl-Space
Simulate Keystroke: Enter

Are you in the Finder? If so, you might be able to write a macro that selects the Mastercard thing from the Services menu rather than use the context menu...?

Ah, now I understand, thanks Chris. But if I have to type ⌃space, only enter is better :man_shrugging:

Not necessarily. I open this context menu with ⌘space and eg the "Mastercard thing" types my credit card number in the front app behind the menu, so to speak.

Oh, I see, so it's a BTT menu that could appear anywhere?

Could you automate the BTT trigger, then typing M and hitting Enter? Probs quicker than doing it manually.

yes :slightly_smiling_face:

unfortunately not. BTT does not recognize that this menu is open. M and enter would then always be typed.

What works is if at the same time with the menu a KM palette is opened, with which space becomes enter. But I can not open the menu and the palette at the same time with ⌘space.

So ⌘-Space is a BTT keystroke trigger? Can't BTT "macros" have multiple actions? Could the "macro" pop that menu then fire off a KM macro that then

  1. Paused until the MasterCard image was on the screen
  2. Selected that menu item by keystroke or mouse click?

But once you've selected the right menu item, Enter does work? Is there any way to get it done using only the keyboard? Can you simulate a few down arrow keys and then the Enter key? Sorry if I'm totally missing the point... :woozy_face:

⌘space (BTT) opens the menu and say ⌥p (KM) opens the palette. I have tried all the possibilities to combine this, but it does not work. But if I open the palette first and then the menu, both are visible and it works.

Yes that is the point enter works but space does not and I want space. With the KM palette space works as enter.

You misunderstand. KM macros can be triggered by scripts. BTT "macros" (do they use a different term?) can include script actions. So your ⌘-Space would trigger the BTT "macro" which:

  1. Opens the menu
  2. Triggers the KM macro (not a palette)

...and the KM macro

  1. Pauses until the MasterCard image is on screen
  2. Activates the menu item by click or keystroke

But this is from someone who's never even installed BTT, so @noisneil can probably explain this better.

I'm not sure...

But I wonder why this does not work? ⌥p should open the KM palette and ⌥ü the BTT menu. But it opens only one or the other.... If I manually execute both shortcuts it works, but not as a macro