11

有什么方法可以获取菜单标题下的所有菜单项列表,例如AppleScriptFileEditAppleScript?

我发现了一些相关的问题,但没有什么确切的。谷歌也没有运气。

我正在尝试获取在 PhotoshopWindow菜单中打开了哪些文件的列表,并找出哪个文件有复选标记。

截图-with-shadow.png

我想我可以通过使用类似“在 Applescript 中,如何确定菜单项是否被选中/聚焦? ”和 Accessibility Inspector 之类的东西来完成第二部分,因为它有AXMenuItemMarkChar

截图-with-shadow.png

4

1 回答 1

12

我没有 Photoshop,但这适用于 Illustrator:

activate application "Adobe Illustrator"
tell application "System Events"
    tell process "Adobe Illustrator CS5.1"
        set xxx to name of every menu item of menu 1 of menu bar item "Window" of menu bar 1
    end tell
end tell

要获取属性,您可以使用:

activate application "Adobe Illustrator"
tell application "System Events"
    tell process "Adobe Illustrator CS5.1"
        set xxx to value of attribute "AXMenuItemMarkChar" of menu item "tools" of menu 1 of menu bar item "Window" of menu bar 1
    end tell
end tell

零场景:

activate application "Adobe Illustrator"
tell application "System Events"
    tell process "Adobe Illustrator CS5.1"
        set xxx to value of attribute "AXMenuItemMarkChar" of menu item "Brushes" of menu 1 of menu bar item "Window" of menu bar 1
        try
            xxx
        on error
            -- insert your code
            beep 2
        end try
    end tell
end tell
于 2012-11-12T01:38:47.430 回答