User interface 用于访问文件上下文菜单元素的Apple脚本
我可以用applescript打开上下文菜单 告诉执行操作“AXShowMenu”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
这把菜单弄上去了。但我无法访问任何菜单项。如何在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