有没有办法在AppleScript的菜单标题File
或Edit
下获取所有菜单项的列表?
我发现了一些相关的问题,但没有一点确切。谷歌也没有运气。
我正在尝试获取在Photoshop的Window
菜单中打开哪些文件的列表,并找出哪一个带有复选标记。
screenshot-with-shadow.png http://img33.imageshack.us/img33/4526/screenshotwithshadow.png
我想我可以通过使用“In Applescript, how can I find out if a menu item is selected/focused?”和辅助功能检查器之类的东西来完成第二部分,因为它有AXMenuItemMarkChar
screenshot-with-shadow.png http://img99.imageshack.us/img99/4526/screenshotwithshadow.png
答案 0 :(得分:10)
我没有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