menu - 如何使用applescript点击 "drop down window"

标签 menu click applescript

所以我的问题是在磁盘战士中,“目录” Pane 下有一个下拉窗口,我无法让 applescript “单击”。无论如何,有没有告诉applescript“单击”下拉窗口,然后单击列表中的磁盘?我的老板希望整个代码自动化,这是我不确定是否可以自动化的一部分。这是我的代码:

do shell script "open /Applications/DiskWarrior.app"
delay 3
tell application "System Events"
    keystroke "my password"
    delay 2
    keystroke return
    delay 3
    keystroke tab
    delay 3
    keystroke return
    delay 20
    --Delay 20 to allow time for the application to fully load
    end tell

diskwarrior 打开后,下一步将选择我想要重建的磁盘,但正如我所说,我不确定如何告诉 applescript“单击”它。

大家有什么建议吗?

最佳答案

do shell script "open -a DiskWarrior"
delay 5
tell application "System Events"
    tell process "SecurityAgent"
        set value of text field 2 of scroll area 1 of group 1 of window 1 to "password"
        click button 2 of group 2 of window 1
    end tell
    delay 5
    tell process "DiskWarrior"
        set frontmost to true
        tell pop up button 1 of window 1
            click
            click menu item 2 of menu 1
        end tell
        set visible to false -- workaround for a glitch in the DiskWarrior UI
        set visible to true
        click button "Rebuild" of window 1
    end tell
end tell

我无法点击重建按钮来工作。在 Automator 中记录 Action 是有效的:

关于menu - 如何使用applescript点击 "drop down window",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13685787/

相关文章:

javascript - 像这样的菜单语言

jquery - 替换元素后点击事件不起作用

javascript - 取消选中复选框时返回初始状态

ios - 无法单击 UIScrollView 内的组件

string - 使用 Automator "Run Applescript"变量

applescript - 脚本系统首选项显示设置

php - 创建一个突出显示当前选项卡的 php 菜单

IE6 渲染菜单的 CSS 问题

xcode - 有没有办法在 Xcode 中列出所有文件及其目标?

java - 如何从菜单按钮 javaFX 中获取选定的项目?