我正在尝试使用当前构建的应用程序来执行脚本以退出Xcode。我当前的脚本只覆盖退出Xcode,但我无法处理Xcode上弹出的确认对话框。在确认框中,有两个按钮选项:取消或停止任务。我想点击停止任务按钮。请帮忙。
到目前为止,这是我目前的AppleScript:
set apps to {"Simulator","Xcode"}
repeat with thisApp in apps
tell application thisApp to quit
end repeat
tell application "System Events"
tell process "Xcode"
click button "Stop Tasks" of sheet 1 of window 1
end tell
end tell
这是我当前的AppleScript,但没有用。
答案 0 :(得分:0)
我能够通过确认对话框提示修复有关终止Xcode的问题。这是我提出的苹果脚本:
try
with timeout of 10 seconds
quit application "Simulator"
quit application "Xcode"
end timeout
on error number e
if e is -1712 then
activate application "Xcode"
tell application "System Events"
tell application process "Xcode"
keystroke return
end tell
end tell
end if
end try