Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
User interface 用于访问文件上下文菜单元素的Apple脚本_User Interface_Applescript_Contextmenu_Finder_Uielement - Fatal编程技术网

User interface 用于访问文件上下文菜单元素的Apple脚本

User interface 用于访问文件上下文菜单元素的Apple脚本,user-interface,applescript,contextmenu,finder,uielement,User Interface,Applescript,Contextmenu,Finder,Uielement,我可以用applescript打开上下文菜单 告诉执行操作“AXShowMenu” 这把菜单弄上去了。但我无法访问任何菜单项。如何在finder中访问文件的菜单项?您可以使用按键选择菜单项: set filename to "test.jpg" tell application "Finder" to activate delay 0.2 tell application "System Events" tell process "Finder" -- set theTa

我可以用applescript打开上下文菜单 告诉执行操作“AXShowMenu”


这把菜单弄上去了。但我无法访问任何菜单项。如何在finder中访问文件的菜单项?

您可以使用按键选择菜单项:

set filename to "test.jpg"
tell application "Finder" to activate
delay 0.2
tell application "System Events"
    tell process "Finder"
        -- set theTarget to value of attribute "AXFocusedUIElement"
        set theTarget to group 1 of scroll area 1 of splitter group 1 of splitter group 1 of window 1
        tell theTarget
            tell image filename to perform action "AXShowMenu"
            delay 0.2
            keystroke "open"
            keystroke return
        end tell
    end tell
end tell
告诉应用程序“系统事件”告诉进程“查找器”告诉窗口{window name}告诉拆分器组1告诉拆分器组1 UI元素告诉滚动区域1 UI元素告诉组1 UI元素告诉图像{filename}执行操作“AXShowMenu”结束提示结束提示结束提示结束提示结束提示结束提示结束提示结束提示我在单击AXShowMenu后无法获取菜单项
set filename to "test.jpg"
tell application "Finder" to activate
delay 0.2
tell application "System Events"
    tell process "Finder"
        -- set theTarget to value of attribute "AXFocusedUIElement"
        set theTarget to group 1 of scroll area 1 of splitter group 1 of splitter group 1 of window 1
        tell theTarget
            tell image filename to perform action "AXShowMenu"
            delay 0.2
            keystroke "open"
            keystroke return
        end tell
    end tell
end tell