Test for "Image" under cursor?

The attached macro uses the Chrome context menu to copy the image under the cursor and paste it into Photoshop. If there is no image under the cursor it goes rogue and opens the "Inspect" window instead. How can I prevent this? I have tried to verify the clipboard "has an image", but by the time the test occurs the "Inspect" window is already opened. I'm sure there's a more logical way to approach this.

Keyboard Maestro 8.2 “FP 2_Copy/Paste Image” Macro

FP 2_Copy-Paste Image.kmmacros (15 KB)

Hey Ray,

Agh! This happens because Apple thinks they're smarter than users and doesn't do proper research.

On the macOS type-select in menus is adaptive instead of literal, so if you type “c” with NO item starting with “c” in the menu the system will pick the next best match (according to it not you.).

This belies the experience of millions of Windows users who use the Alt key to open and select menu items via a series of keystrokes.

Not only that, but accessibility doesn't work consistently with contextual menus – and fault for that is squarely upon Apple's shiny little pate.

You're only choice for fairly bombproof function is to use a Click at Found Image action.


You'll have to copy the image on your system using Cmd-Shift-4 with the Control key down – then paste into the image well in the action. (You can view what's in the image well via Quick Look – SpaceBar.)

Oh, yeah – I'm not handling a timeout for instance when the image is not found, but I would in any production macro.


1 Like

@rcraighead, I think I might have a solution for you, IF your use case is primarily right-clicking in Chrome. It works on some Safari web pages, but not all (have no idea why).

I believe it should be more reliable than what you have now, and more reliable than clicking on Found Image. Please give it a try and lets us know how it goes.

Note that you will need to change the 3rd Action in magenta, to be whatever menu item you wish to use.

MACRO:   Click on Selected Context (Right-Click) Menu Item [Example]

~~~ VER: 2.0    2018-04-10 ~~~


Click on Selected Context (Right-Click) Menu Item [Example].kmmacros (18 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.




  • Perform a Right-Click and then Click on Selected Menu Item


  1. KM 8.2+
  • But it can be written in KM 7.3.1+
  • It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
  1. macOS 10.11.6 (El Capitan)
  • KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees. :wink:

NOTICE: This macro/script is just an Example

  • It has had very limited testing.
  • You need to test further before using in a production environment.
  • It does not have extensive error checking/handling.
  • It may not be complete. It is provided as an example to show you one approach to solving a problem.

How To Use

  1. Position the Mouse over the Item of Interest
  2. Trigger this macro.
    • It will then do a Right-click, and click on the chosen menu item.


  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
  1. Assign a Trigger to this maro..
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro.
    (all shown in the magenta color)
    • Set MenuItemName to Menu Item You Wish to Use

TAGS: @Menu @ContextMenu @Chrome @Safari @Example


  • Any Action in magenta color is designed to be changed by end-user


  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions


  • While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.


As always, please feel free to post any questions, issues, and/or suggestions concerning this macro.

1 Like

Thank you, both. I’ll give your suggestions a try and report back.