无法使用 AppleScript 获取 Logic Pro X 中弹出按钮的菜单(或菜单项)



所以基本上我想写一个在 Logic Pro X 中启动插件的 AppleScript,但即使单击弹出按钮,它也无法到达菜单(因此没有菜单项(插件(( 这是菜单 这是我尝试过的,我找到了"Audio FX"弹出按钮的位置,我可以单击它,但我想知道是否有任何方法可以到达其中的菜单 1?根据Automator的Watch Me-Do,它应该在那里,但由于某种原因我无法进入菜单

tell application "Logic Pro X" to activate
tell application "System Events"
tell process "Logic Pro X"
set frontmost to true
tell (first window whose subrole is "AXStandardWindow")
tell group "Audio FX" of group 1 of group 1 of list 1 of list 1 of group 2
tell pop up button 1
click
click menu item 3 of menu 1
end tell
end tell
end tell
end tell
end tell

所以我得到的错误是这样的:

error "System Events got an error: Can’t get menu 1 of pop up button 1 of group "Audio FX" of group 1 of group 1 of list 1 of list 1 of group 2 of window 1 of process "Logic Pro X" whose subrole = "AXStandardWindow". Invalid index." number -1719

我同意箭牌@Ted的评论可能是竞争条件的问题。 这样的东西可能对你有用。

tell application "Logic Pro X" to activate
tell application "System Events"
tell process "Logic Pro X"
set frontmost to true
tell (first window whose subrole is "AXStandardWindow")
tell group "Audio FX" of group 1 of group 1 of list 1 of list 1 of group 2
repeat while not (exists of pop up button 1)
delay 0.1
end repeat
tell pop up button 1
click
repeat while not (exists of menu item 3 of menu 1)
delay 0.1
end repeat
click menu item 3 of menu 1
end tell
end tell
end tell
end tell
end tell

最新更新