Finding a Dynamic Menu Item -- Use KM Recorder

I'm trying to set a keyboard shortcut to a menu item in Adobe Lightroom Classic. The item is in a submenu of the File menu:

It doesn't show up in KM's duplication of the application's menu hierarchy:

image

I've tried adding a few spaces before the entry in the "Menu Item" field but it doesn't help.

Any ideas gratefully received. I've seen a few vaguely similar topics here but the solutions proffered don't seem appropriate.

Jeremy

This is the macro I set up for Auto Stacking in Lightroom:

KM 0 2021-05-18_09-31-06

Auto Stack.kmmacros (2.5 KB)

I used the ability of the Select a Menu Item action to drill down the Lightroom menus to find the Auto-Stack option.

Hope that helps.

Yes, I've done that for other menu items in LR. The problem, as I set out in my original post, is that it doesn't work for this menu item, which is absent from KM's "drill down" ability.

OK - it wasn't clear to me how you were drilling down.

Try using a regular expression (see the KM wiki 5th paragraph down https://wiki.keyboardmaestro.com/action/Select_or_Show_a_Menu_Item) like this:
KM 0 2021-05-18_11-22-43

Notice that

^.*Export to Helicon

will match literally "Export to Helicon" preceded by anything else.

If you know regex, this should be a doddle. If not let me know which item you're trying to find.

Cheers.

BTW - forgot to mention: I typed-in "Plug-in Extras" manually in the action above.

Thanks. Sorry - should have said it was the "QImage One" menu item. Regex didn't work, but I tried recording a macro, then deleting all steps apart from "select menu" and that has worked.

Jeremy

2 Likes

Hey Jeremy,

The best way to handle Select or Show a Menu Item actions is to use the ‘Menu’ pop-up menu in on the right side and under the gear menu.

When you select a menu item directly from the app using this menu, you nearly always get the correct syntax.

-Chris

Generally yes, Chris - but that didn’t work for him, as he showed in post #1.

Ah, I missed that.

Thanks.

1 Like

It would seem that Lightroom handles its menus in a non-standard fashion. Anyway, the problem is now solved. Thanks to those who offered help.

Jeremy

2 Likes

Good thinking. What did the end result look like?

-Chris

Like this:

image

There are three characters before the Q, which appear to be spaces (copy and paste into BBEdit then hex dump shows 20 20 20). I had tried entering n spaces by hand, with n in 1...5, but it didn't (and doesn't) work. Jolly odd.

Jeremy

1 Like

Thanks for sharing! That is the best use for the KM Recording feature that I have seen.
:+1:

@kikashi

I am trying to solve a problem almost identical to yours. I tried recording a macro, but all I got was mouse clicks relative to the screen's left corner.

How can I get real actions like you show here?

Hey Paul,

Recording in KM is very hit and miss – for some things it works nicely – for others...

See the image in the Select or Show a Menu Item action help on the wiki.

Note the pop-up menu of the action that lets you directly select menu items from a given application.

What you'll probably need to do is use TWO select-menu actions. I'll demonstrate using the Finder:

Dynamic Select Menu Example v1.00.kmmacros (2.9 KB)
Keyboard Maestro Export

-Chris

@ccstone

My problem is exactly the same as @kikashi. I'm trying to get the "Plug-in Extras" menu of Adobe Lightroom Classic, which is apparently generated on the fly. Using the Menu dropdown produces a very simplistic list.

But you can see that Lightroom provides a much deeper File menu

Agh! Apple's cutesy if it's not broke let's fix it shtick...

I can't test this, as I'm still using macOS 10.14.6 Mojave.

But let's have a go...

What happens when you type-select in that menu?

Run this in Apple's anemic Script Editor or preferably Script Debugger.

Plug for SD...

Run, don’t walk over to Late Night Software and download Script Debugger. Even if you don’t buy a copy and instead use the freeware “Lite” version it is far, far superior to Apple’s painfully decrepit and neglected Script Editor.

  • Regex find/replace support.
  • Step through your code line by line (commercial only).
  • Breakpoints (commercial only).
  • Script Debugger Feature Comparison
    • Literally hundreds of more features...
tell application "System Events"
   tell application process "Lightroom Classic"
      set its frontmost to true
      
      tell menu bar 1
         tell menu "File"
            perform action "AXPress"
            tell menu item "Plug-in Extras"
               perform action "AXPress"
               tell menu 1
                  return name of menu items
               end tell
            end tell
         end tell
      end tell
      
   end tell
end tell

Let me know what you get in the Results panel of the Script Editor.

I ran this in both Script Debugger and Script Editor and got the same failure

System Events got an error: Can’t get menu item "Open With" of menu "File" of menu bar 1 of application process "Lightroom Classic".

@paulwaldo I used the recording only to find the actual name of the QImage menu item. It was a long time ago and I can't now remember the details, but as you can see, my difficulty lay in getting the correct name for that menu item.

When setting up the KM macro, I just typed the menu title and menu names into KM's dialog. Have you tried that? In the Macro, Menu title is "File", Submenu is "Plug-in Extras" and Menu Item is "Flickr Extras…"

I don't have the Flickr export enabled, but I just tried recording a selection from that submenu and it seems to work: I ended up with this.

image

Agh! I must have been tired, 'cause I really flubbed that.

I've changed the menu item names in the original script to be correct (I think).

Take a look at the script and see if you concur that the menu names are correct.

Then run it again please.