AppleScript: Lightroom 5: action “AXShowMenu” in Smart Collection panel does not show context menu

谁说胖子不能爱 提交于 2019-12-02 10:26:54

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

Some application need a real click.

Try this

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!