Yes, for the Finder anyway, using AppleScript. And for all other Apps using Keyboard Maestro's Move to Found Image Action to move and right-click at the highlighted item.
First the AppleScript approach (this AppleScript is from @eurobubba in this past post: Has Anyone Figured Out a Way to Replicate the Windows "Menu Key" on a Mac Using KM? - #8 by eurobubba)
.NOTE - this only works in the Finder (but as that was your need, maybe this will do it for you).
Once this Macro has opened the context menu of the selected file, you can select the menu item you want by either having Keyboard Maestro type the first letters of its name or by having Keyboard Maestro simulate arrow keys to move to the item you want.
Finder - Open Context Menu.kmmacros (4.5 KB)
on run
try
main()
on error msg number errno
if errno is not -128 then
activate
display alert msg message "Error Number : " & errno
end if
end try
end run
on main()
--activate application "Finder"
tell application "System Events"
tell application process "Finder"
set frontmost to true
set ui to value of attribute "AXFocusedUIElement"
tell application "Finder" to activate
set a_class to class of ui
if a_class is outline then
tell ui
try
perform action "AXShowMenu"
return
on error
beep
end try
end tell
return
else if a_class is scroll area then
tell outline 1 of ui
set a_row to item 1 of (rows where it is selected)
tell UI element 1 of a_row
try
perform action "AXShowMenu"
on error
beep
end try
end tell
end tell
else if a_class is group then
tell ui
set an_item to item 1 of (UI elements where it is selected)
tell an_item
try
perform action "AXShowMenu"
on error
beep
end try
end tell
end tell
else if a_class is browser then
tell scroll area 1 of ui
set n_list to count scroll areas
repeat with n from n_list to 1 by -1
tell list 1 of scroll area n
set selected_elements to (UI elements whose selected is true)
if length of selected_elements > 0 then
tell item 1 of selected_elements
try
perform action "AXShowMenu"
on error
beep
end try
end tell
exit repeat
end if
end tell
end repeat
end tell
end if
end tell
end tell
-- return theResult
end main
on showMenu(anElement)
tell me
activate
display dialog "WTF?"
end tell
end showMenu
To invoke the Context Manu in other Apps I made another Macro here: (Has Anyone Figured Out a Way to Replicate the Windows "Menu Key" on a Mac Using KM? - #35 by Zabobon).
I agree. I can't believe Apple haven't assigned a key that just does this. It is one of the few things that Windows (the name that shall not be spoken...) has but the Mac doesn't