AppleScript的右击一个文件 [英] Applescript right click a file

查看:683
本文介绍了AppleScript的右击一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有苹果脚本命令右击一个文件,弹出快捷菜单?

我正在寻找类似

 告诉应用程序发现者
    设置theDesktopItems桌面的每一个项目
    theDesktopItems的右键单击第1项
告诉结束


解决方案

这是对系统事件的应用程序的工作。它可以用来到达的菜单项以及它们在大多数应用中操作,即使是那些否则不脚本化

试试这个:

 告诉应用程序系统事件
    告诉进程发现者
        设置target_index 1
        设定的目标,以滚动区1 1组图像target_index
        告诉目标执行操作AXShowMenu
    告诉结束
告诉结束

检查此链接使用系统事件的概述,如果你是这样的倾向:<一href=\"http://n8henrie.com/2013/03/a-strategy-for-ui-scripting-in-applescript/\">http://n8henrie.com/2013/03/a-strategy-for-ui-scripting-in-applescript/

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/

这篇关于AppleScript的右击一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆