AppleScript的:Lightroom中5:动作" AXShowMenu"智能集合面板不显示上下文菜单 [英] AppleScript: Lightroom 5: action "AXShowMenu" in Smart Collection panel does not show context menu

查看:449
本文介绍了AppleScript的:Lightroom中5:动作" AXShowMenu"智能集合面板不显示上下文菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发使用的Lightroom 5(CC的最新版本)的简单自动化工具使用AppleScript。

We are developing a simple automatization tool using Lightroom 5 (the newest version of the CC) using Applescript.

对于一些行动,我们需要在智能集合面板的上下文菜单,例如导入智能收藏描述。

For some actions, we need the context menu in the Smart Collections panel, for example to import Smart Collection descriptions.

根据该文件,并在这里计算器和其他地方的不同来源,AXShowMenu应该调出该菜单。

According to the documentation and various sources here on stackoverflow and elsewhere, AXShowMenu should bring up that menu.

到目前为止,我还没有能够使该上下文菜单弹出。

So far, I have not been able to make that context menu pop up.

使用UIElementInspector和UI浏览器,我所在其中确实有AXShowMenu动作连接的元素。基于浏览器的用户界面提供的code,我得到了下面的脚本,这是我从AppleScript的编辑器中运行:

Using UIElementInspector and UI Browser, I located the element which does have the AXShowMenu action attached. Based on the code provided by UI Browser, I got the following script, which I run from the Applescript Editor:

tell application "Adobe Photoshop Lightroom 5"
    activate
    tell application "System Events"
        tell process "Lightroom"
            set frontmost to true
            perform action 1 of static text "Smart Collections" of group 1 of row 11 of outline 1 of scroll area 1 of window 6
            delay 2
        end tell
    end tell
end tell

tell application "AppleScript Editor" to activate

请注意,如果你试图重新创建此,窗口的数量,以及该行的数目可以是不同的。此外,最后一行就是方便,而不是为code真正相关。

Note that if you try to recreate this, the number of the window as well as the number of the row may be different. Also, the last line is just convenience, and not really relevant for the code.

在在的AppleScript编辑器中结果窗口,我有以下几点:

In the Results window in AppleScript Editor, I have the following:

perform action 1 of static text "Smart Collections" of group 1 of row 11 of outline 1 of scroll area 1 of window 6 of process "Lightroom"
    --> action "AXShowMenu" of static text "Smart Collections" of group 1 of row 11 of outline 1 of scroll area 1 of window 6 of application process "Adobe Photoshop Lightroom 5"

这意味着我做调用的动作。

which means that I did invoke the action.

但是......什么也不会发生。

But … nothing happens.

任何有识之士,解决方法等是高度AP preciated。

Any insight, workaround etc. is highly appreciated.

先谢谢了。

推荐答案

我试试你的脚本上的的Lightroom 4 ,这里同样的结果。

I try your script on Lightroom 4, same results here.

某些应用程序需要一个真正的点击。

Some application need a real click.

试试这个

tell application "System Events"
    tell process "Lightroom"
        set frontmost to true
        set {x, y} to position of text field 1 of row 11 of outline 1 of scroll area 1 of window 6
        my realClick(x, y, "Right") -- "Right" = mouseRight, "Left" = mouseLeft
        delay 0.5
        key code 125 -- arrow down to select first menuitem
        keystroke return -- to click on menuitem
    end tell
end tell

on realClick(x, y, leftRight)
    do shell script "/usr/bin/python -c 'import Quartz.CoreGraphics  as qcg
def mouseEvent(type):
    e=qcg.CGEventCreateMouseEvent(None, type, (" & x & "," & y & "), r)
    qcg.CGEventPost(qcg.kCGHIDEventTap, e)

if \"" & leftRight & "\" is \"Left\": r= qcg.kCGMouseButtonLeft; mouseEvent(qcg.kCGEventLeftMouseDown); mouseEvent(qcg.kCGEventLeftMouseUp)
else: r= qcg.kCGMouseButtonRight; mouseEvent(qcg.kCGEventRightMouseDown); mouseEvent(qcg.kCGEventRightMouseUp)'"
end realClick

这篇关于AppleScript的:Lightroom中5:动作" AXShowMenu"智能集合面板不显示上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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