AppleScript UI programming - how to Control-Click a UI element?
I’m doing some AppleScript UI programming, and there is a menu item that I need to access that only appears as a contextual menu when clicking in a particular UI element, i.e. it needs a control-click (or right-click, for people with right-hand mouse configuration) to appear, not just a standard click.
I can click the relevant UI element to select it OK in AppleScript:
tell application “System Events”
tell application process [ target application ]
click [ hierarchy to the relevant UI element ]
end tell
end tell
But I need a control-click to make the menu appear. System Events cannot address the menu until after it appears.
How does one control-click in AppleScript? I searched the internet in vain, and I tried things like:
click [ hierarchy to the relevant UI element ] using control down
but that didn’t work - syntax error.
Surely control-clicking or right-clicking is a pretty basic function that can be done in AppleScript?
Thanks for any help.
Mac mini, macOS 14.6