Can "Select Menu Item" select an item in an Icon menu?

At the right end of a macOS menu bar are menus with icons instead of names, e.g., Sound, Wi-Fi, Bluetooth, Time Machine. Is there a way for a "Select Menu Item" action to select an item in one of these special menus?

I've created KM macros to select items in the Sound menu using "Move and Click and Drag" actions to simulate mouse actions on the menus based on screen positions relative to the upper-right corner of the screen.

There are two serious shortcoming of simulating mouse actions on menus:

  • The horizontal position of the Icon menus change because the width of the date and time (at the right end of the menu bar) varies.
  • The list of menu items changes, e.g., when devices are added or removed.

Have you tried this?

image

With this the position of the icon does not matter.

KM can’t interact with these natively, however, you can use GUI AppleScript to do it.

On my system, the following AppleScript clicks the Bluetooth icon (click to expand/collapse)
tell application "System Events"
	tell application process "Control Center"
		tell menu bar 1
			click (first menu bar item whose value of attribute "AXDescription" is "Bluetooth")
		end tell
	end tell
end tell