gpt4 book ai didi

macos - 如何使用 Applescript 获取菜单项列表?

转载 作者:行者123 更新时间:2023-12-04 07:05:21 26 4
gpt4 key购买 nike

有什么方法可以获取菜单标题下所有菜单项的列表,例如 FileEdit用 AppleScript?
我发现了一些相关的问题,但没有确切的答案。谷歌也没有运气。
我正在尝试获取在 Photoshop 中打开哪些文件的列表 Window菜单,并找出哪个有复选标记。
screenshot-with-shadow.png

我想我可以通过使用类似“In Applescript, how can I find out if a menu item is selected/focused?”和辅助功能检查器来完成第二部分,因为它有 AXMenuItemMarkChar screenshot-with-shadow.png

最佳答案

我没有 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

关于macos - 如何使用 Applescript 获取菜单项列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13337298/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com