Applescript right click a file

后端 未结 1 1954
悲&欢浪女
悲&欢浪女 2021-01-13 10:37

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\"
          


        
相关标签:
1条回答
  • 2021-01-13 11:34

    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/

    0 讨论(0)
提交回复
热议问题