How do I emulate "Right-click" or "Control-click"?

I’m trying to create a macro in which one step involves opening a contextual menu. The contextual menu is normally invoked by moving the cursor into position and executing a Right-click" or “Control-click”.

How do I do this in a KM macro?

1 Like

The Move or Click Mouse action can right or control click.

What is the method for right-clicking a link in Safari? I know I can right-click a screen location (as recommended above), and I know I can specify the Safari link for left-clicking (with the “Click Safari link” Action). How best to right-click a specific Safari link?


There is no way in general to find the location on the screen of any given thing, including the text insertion point. So there is generally no way to right click on anything except based on its position, or by finding it some way (such as based on finding the image on the screen for example).

If the link is on the screen, and is unique, then you can use the Click at Found Image variant of the Mouse Click action to right click on the link.

Alternatively, you can use JavaScript to find the entry, and then there may be a JavaScript command to invoke the contextual menu, although I don’t know for sure that there is.

Thank you.

I had hoped for more than screen location due to being able to tab from link to link using the Safari preference “Advanced ▹ Accessibility ▹ Press Tab to highlight each item on a web page”. Various modify keys + {return} allow me to open the tabbed-to link in a new window, to add it to my “Reading List” … from which I conclude that the OS has some specific understanding of the selected link as a link. It seems logical to me that if the OS allows the user to tab to a link, it would allow the user to access the context menu there.

I will find another way to my goal — KM gives me lots of ways to get from here to there.

Thanks again for the timely help :smiley:

Hey Kirby,

You'd think so, but Apple does many things that aren't logical or even reasonable.

Best Regards,

1 Like

Just a quick note to say “this works”: in an instance where my existing work-arounds failed, I was able to use “Click at Found Image”. :+1:

A search of the forum turned up a useful example using the “If ▹ The Screen ▹ Contains” variant of the Action “If All Conditions Met”.

My thanks again!

Use Vimium instead. Just press “f” to find all the links on the page, then follow the link you want press the key combo that Vimium assigns to the link you want. You can even press “F” to open the link in a new tab, “yf” to copy the link, and much more.


Vimium looks very powerful, but also very intrusive. I wonder how it works when you are in a browser input area, like creating/editing a forum post?

I would be very interested in hearing others who have used Vimium.

1 Like

You can Vimium completely, or just disable specific keys for a particular website. E.g. I disable a specific list of keys that Vimium would usually respond to when I am using a Jupyter notebook. For a different website, I can disable a different list of keys, so that I can only have the precise vimium functionality I want. You can also place your cursor into a text input field by pressing “gi” (go input) I’m a huge fan, as you can probably tell :slight_smile:

My favorite thing I get from Vimium is text navigation. If you are familiar with Vim, you already know how this works. For example, if I want to select and copy a paragraph: type “/“ to enter search mode, type a word, then type “v” which puts me in to “visual mode,” at which point I can use other shortcuts to quickly select the text I want, e.g. “}” will select by whole paragraphs at a time.

The functionality is really quit vast and can potentially change the way you use your browser. Quick access to bookmarks, quick navigation of links (if you have a URL in your clipboard, press “P” to open a new tab, paste the clipboard contents, then navigate to that URL.) The list goes on.


Hey Andrew,

Spiffy. I’ve used similar extensions in the past but found them too crude and intrusive.

This one looks pretty polished.

Is there a way to toggle it on/off with a keyboard shortcut?


1 Like

Pressing “i” – all commands will be ignored until you hit Esc to exit


I can not find "The Move or Click Mouse action can right or control click".

Where is that located in the current KeyboardMaestro?

This is the item I want to select ("Reveal in Element tree"):

The menu is activated by a right-click on an element.

The Action is called "Move or Click Mouse"

Once you have added it to your Macro you set it up like this:

Bear in mind that it is an exact replication of clicking the right mouse button so, the mouse needs to be already hovering over the correct place/item. It won't work if an item is simply selected and the mouse pointer is somewhere else on screen.

Once the contextual menu is showing it is usually possible to have Keyboard Maestro select the menu item by having an Insert Text by Typing Action which types the item's name, followed by an Action that presses "Return". Sometimes the system needs time to catch up so inserting tiny pauses between the Actions can help - you will need to experiment.

Thank you, I found the "Move or Click Mouse" item.

Here is my setup: Image 2023-03-12 at 9.45.07 AM

When I execute, the context menu does not show. I just see this KM palette open:

The "Search Records" element is the target. Before executing the KM keystroke, the item is selected and the mouse is hovered over it.

That is because you have two macros with the same hotkey ⌃⇧E. Give one of them a new hotkey.

That Palette you are seeing is the Keyboard Maestro Conflict Palette. In this case it stops your Macro working but many other times is can be very useful as it allows you to give the same hotkey to several Macros and you choose the one you want to run by clicking it on the Palette. It means you don't have to remember so many shortcuts.

Simply great, how @Zabobon explains even the simplest things with the patience of an angel and the pedagogical skills of an experienced teacher. And he is far from being the only one. I will not list them one by one, just thank you all :slightly_smiling_face:


Thank you @Zabobon for all your help.

I fixed the conflict.

Now the menu opens at mouse location, but...the menu ( does not respond to typing.

I am going to look for a mouse move by pixels, and then click.

Is there a better way?

Try looking for any other way to navigate down that context menu. Then Keyboard Maestro has something it can emulate. Do arrow keys work? Tab key?

One option you might have is to get Keyboard Maestro to click on found image.

1 Like