Choosing a menu command when the menu text varies?

I would like to set a hot key so that I Photos, when I hit CMD + SHIFT + E, instead of doing the default export, I want to do the export unmodified. I thought I could use Menu commands, but the menu commands change depending on how many items are selected, as the image is shown below:

Is there a way I can set up a macro for this, given that I might want to export 1 or 100 items. Note that using Found image is not an option as I would have to cater for light/dark mode and also changes of accent color.

Do you think this is possible?

Yes.

You can use a regular expression in a Select Menu action. Have a look here for an example:

1 Like

Here's another method:

This opens the menu and submenu and then uses Insert Text by Typing to select the menu item. You only need enter enough text to select the correct item; the number which follows is of no consequence.

I have this exact same Menu Action in a Photos Macro I use. I can't remember exactly how I found the syntax to do it but the below works:

And the Menu Item is written as ^Export Unmodified Original which you should be able to copy and paste from here into your own Action. (This finds the Menu Item whether it is for one or several photos).

2 Likes

Ooh that is nice! Will replace all my typing versions with this! :clap:t3::clap:t3:

1 Like

Yes, that is good to know (^)

Certainly helpful would be the choice of the (sub)menu by position. In this case "2". Then the name would no longer matter.

1 Like

Just for the heck of it, here's an AppleScript version:

tell application "System Events"
	tell process "Photos"
		tell menu bar 1
			tell menu bar item "File"
				tell menu "File"
					tell menu item "Export"
						tell menu "Export"
							click (menu item 1 where its name starts with "Export Unmodified")
						end tell
					end tell
				end tell
			end tell
		end tell
	end tell
end tell
1 Like

That did the trick perfectly! Thank you

1 Like