2

所以我的问题是在磁盘战士中,“目录”窗格下有一个下拉窗口,我无法让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“点击”它。

有人有什么建议吗?

4

1 回答 1

2
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 中记录操作虽然有效:

于 2012-12-03T17:31:51.177 回答