所以我的问题是在磁盘战士中,“目录” 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/