Context: I'm trying to select a macOS sounds output from the Sounds status menu list of sound outputs and inputs using keyboard rather than mouse. The output I want to select is my hearing aids ("HAs") which are listed as one of the output choices with a blue mini-icon if they're already selected or a gray mini-icon if they're not.
Macro logic: find and click on the Sounds status menu title image to drop down the menu. Find the already-selected HAs icon at its relative offset from the menu title.If found, Cancel macro. Find the not-selected HAs icon at its relative offset from the menu title and set local_HAs_Offto the result. If not found, SystemBeep and Cancel this Macro (because HAs not available as an output). Otherwise these actions, the first of which is for debugging:
Display text of %Variable%local_HAs_Off%
displays 2155,220,160,32,4 [confirmed correct by mouse coordinates utility]
Move and Click At (local_HAs_Off+21,local_HAs_Off+14) from the absolute position.
Generates notification:
Macro Cancelled ... Move or Click Mouse calculation local_HAs_Off+21 failed. Macro "Sounds status menu::click HAs" cancelled (while executing Move and Click at (local_HAs_Off+21,local_HAs_Off+14) from the Absolute Position).
I'd appreciate any ideas on what I'm overlooking or how to debug the issue.