radioaktiv radioaktiv - 1 year ago 58
AppleScript Question

Notified when AppleScript command finishes

I have the following


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

Basically the script launches XCode and executes the tests. The problem is that the script is marked as finished as soon as the last command is executed. That means the tests start and there is no way to find out whether they are finished or not.

Any ideas about how to determine whether the tests are finished or not ?

Answer Source

Are you aware that Xcode is scriptable?

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
        repeat until completed of last scheme action result
            delay 0.5
        end repeat
        set lastTestResult to last scheme action result
    end tell
end tell
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download