I'm trying to write a simple script using AppleScript that can identify and close a floating menu on the touch bar. An example, for clarity:
Suppose that I've opened the Spotify floating menu on the touch bar. I'd like the script to first identify that that floating menu is open and close it immediately after.
So far, the only lead I've found into scripting the touch bar in general (as opposed to writing AppleScript-based buttons for the touch bar, as with the likes of BetterTouchTool) is this post, but it identifies the touch bar UI elements for the currently open application (if it has touch bar support) as opposed to the touch bar UI elements for the currently open floating menu.
Any ideas on how I might instead identify the UI elements for the floating menu, and then close the floating menu based on that detection?