I haven’t been able to find any way to activate the control-key or ‘right-click’ contextual menu for an application using UI commands. An example of what I hoped would work–but doesn’t–for the TextEdit application is (say you’re cursor is hovering over a mispelled):
tell application "TextEdit"
activate
tell application "System Events"
tell process "TextEdit"
key down control
click
key up control
(* right click *)
end tell
end tell
end tell
Does anyone know a technique that might work?