有没有Apple Script命令可以右键单击文件并弹出上下文菜单?
我正在寻找类似以下的内容:
tell application "Finder"
set theDesktopItems to every item of desktop
right click item 1 of theDesktopItems
end tell
有没有Apple Script命令可以右键单击文件并弹出上下文菜单?
我正在寻找类似以下的内容:
tell application "Finder"
set theDesktopItems to every item of desktop
right click item 1 of theDesktopItems
end tell
这是系统事件应用程序的工作。它可用于访问大多数应用程序中的菜单项及其操作,即使这些应用程序本来不支持脚本。
请尝试:
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
如果您有兴趣,可以查看此链接以了解使用系统事件的概述:http://n8henrie.com/2013/03/a-strategy-for-ui-scripting-in-applescript/