Is there a command in apple script to right click a file and bring up the context menu?
I'm looking for something like
tell application "Finder"
set theDesktopItems to every item of desktop
right click item 1 of theDesktopItems
end tell
This is a job for the System Events application. It can be used to reach menu items and their actions in most applications, even those that are otherwise not scriptable.
Try this:
tell application "System Events"
tell process "Finder"
set target_index to 1
set target to image target_index of group 1 of scroll area 1
tell target to perform action "AXShowMenu"
end tell
end tell
Check this link for an overview of using System Events if you are so inclined: http://n8henrie.com/2013/03/a-strategy-for-ui-scripting-in-applescript/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With