Applescript 点击未知菜单项?

Applescript clicking unknown menu item?

我正在使用 LG OnScreen Control 应用程序在不同的显示器布局之间切换,这些布局在菜单项中没有名称,因为它使用图片。我想写一个 applescript,点击第一个或第 9 个,我最喜欢的 selections。 =)

我怎样才能点击它们?我只能用下面的代码select点击它们

ignoring application responses
    tell application "System Events" to tell process "OnScreen Control"
        click menu bar item 1 of menu bar 2
    end tell
end ignoring
delay 0.1
do shell script "killall System\ Events"

tell application "System Events" to tell process "OnScreen Control"
    tell menu bar item 1 of menu bar 2
        click menu item "Screen Split" of menu 1
    end tell
end tell

UPDATE1: 啊傻我,我想我可以多次使用“key code 125”点击向下箭头和“key code 76”点击回车。

ignoring application responses
    tell application "System Events" to tell process "OnScreen Control"
        click menu bar item 1 of menu bar 2
    end tell
end ignoring
delay 0.1
do shell script "killall System\ Events"

tell application "System Events" to tell process "OnScreen Control"
    tell menu bar item 1 of menu bar 2
        click menu item "Screen Split" of menu 1
        key code 125
        key code 125
        key code 125
        key code 125
        key code 125
        key code 125
        key code 125
        key code 125
        key code 76
    end tell
end tell

想知道是否有更好更快的方法来执行此操作?没有名字直接给子项写地址?

UDPATE2 感谢@user3439894

的解决方案
ignoring application responses
    tell application "System Events" to tell process "OnScreen Control"
        click menu bar item 1 of menu bar 2
    end tell
end ignoring
delay 0.1
do shell script "killall System\ Events"

tell application "System Events" to tell process "OnScreen Control"
    tell menu bar item 1 of menu bar 2
        click menu item "Screen Split" of menu 1
        click menu item 9 of menu 1 of menu item "Screen Split" of menu 1
    end tell
end tell

之后:

click menu item "Screen Split" of menu 1

使用:

click menu item 9 of menu 1 of menu item "Screen Split" of menu 1

删除所有 key code 命令