Trouble "clicking" second-level status bar menu item

The recent Stream Deck 6.4.1 update for the Mac introduced a menu bar sub-menu for the profiles list. In the previous version, the profiles were on the top-level menu, visible just by clicking the SD icon in the menu bar.

Unfortunately, moving the profiles list to a second level broke the Applescript I was using to change profiles for some Adobe products. I’m updating the script, trying to “click” items in the second level menu, but it doesn’t seem to be working with the normal AppleScript syntax.

tell application "System Events"
tell process "Stream Deck"
	click menu bar item 1 of menu bar 2
	delay 0.5 -- give it time to draw menu
	click menu item "LR-Home" of menu 1 of menu item 7 of menu 1 of menu bar item 1 of menu bar 2
end tell
end tell

Unfortunately, this script doesn’t execute “click menu item “LR-Home” of menu 1 of menu item 7 of menu 1 of menu bar item 1 of menu bar 2” Here’s the element path reported by UI Browser:

It looks like my AppleScript should work. Do you see any errors, or is it possible the new Stream Deck version has implemented its second-level menu in a non-standard way that AppleScript can’t parse?

On a related matter, UI Browser (which I know its no longer supported) doesn’t seem to be able to browse into status menus, so I can’t use its “reference to selected element” function. Does anyone here know how to get UI Browser to generate the reference to a status menu item?

Thanks,
Russell

If the sub-menus are generated dynamically, you might have to click the 1st-level menu item as well.

tell application "System Events"
	tell process "Stream Deck"
		click menu bar item 1 of menu bar 2
		delay 0.5 -- give it time to draw menu
		click menu item 7 of menu 1 of menu bar item 1 of menu bar 2
		delay 0.5
		click menu item "LR-Home" of menu 1 of menu item 7 of menu 1 of menu bar item 1 of menu bar 2
	end tell
end tell

I think that did it!

Now I’ll take this syntax and see if I can implement it in my “real” system, which uses variables to track the previous Stream Deck profile I was using, so I can go back one button set, no matter where I came from. Should be no problem, sense that is independence of the menu end clicking syntax.

Thank you so much for your kind help!

Regards,
Russell