AppleScript命令完成时通知

时间:2017-05-18 06:47:02

标签: xcode scripting applescript

我有以下AppleScript

tell application "Finder"
    open file "MyApp.xcworkspace" of folder of (file (path to me))
end tell

tell application "System Events"
    delay 5
    keystroke "u" using {command down}
end tell

基本上,脚本启动XCode并执行测试。问题是,一旦执行完最后一个命令,脚本就会被标记为已完成。这意味着测试开始,无法确定它们是否已完成。

有关如何确定测试是否完成的任何想法?

1 个答案:

答案 0 :(得分:1)

你知道Xcode是可编写脚本的吗?

tell application "System Events" to set myWorkspace to path of file "MyApp.xcworkspace" of container of (path to me)
tell application "Xcode"
    open myWorkspace
    set activeDoc to 1st workspace document
    tell activeDoc
        test
        repeat until completed of last scheme action result
            delay 0.5
        end repeat
        set lastTestResult to last scheme action result
    end tell
end tell