Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tell AppleScript To Build XCode Project

The following are the steps I would like to have:

  1. launch xcode
  2. open a specific xcodeproj file
  3. build and debug it
  4. quit xcode

The following is my first attempt to write AppleScript:

tell application "Xcode"
    tell project "iphone_manual_client"
        debug
    end tell
    close project "iphone_manual_client"
end tell

This only works when xcode has this project opened. I would like to have the project to be opened only when it is necessary to do so.

Can any AppleScript gurus out there points me to the right direction? Thanks.

-chuan-

like image 845
chuan Avatar asked Jun 17 '09 13:06

chuan


1 Answers

I think I managed to solve it. The following is the AppleScript:

tell application "Xcode"
    open "Users:chuan:Desktop:iphone_manual_client:iphone_manual_client.xcodeproj"
    tell project "iphone_manual_client"
            clean
            build
            (* for some reasons, debug will hang even the debug process has completed. 
               The try block is created to suppress the AppleEvent timeout error 
             *)
            try
                debug
            end try
    end tell
    quit
end tell

The path has to be in format of ":" instead of "/". The only problem now is that after the debug console has done its job, AppleScript seems to "hang" as though waiting for something to happen. I need to do more research on AppleScript to know what is wrong with the script.

like image 123
chuan Avatar answered Sep 21 '22 17:09

chuan