views:

21

answers:

1

I'm currently using AppleScript to clean up an Xcode project. I'd like my script to remove some build configurations that won't be relevant to other developers on my team.

For example, if I have "Debug", "DebugTest", and "Release", I would like the script to remove "DebugTest".

I'm currently using the following script:

tell application "Xcode"
open myXcodeProject
    set targetProject to project of active project document
    set targetConfigurations to build configurations of targetProject
    repeat with c in targetConfigurations
        if (name of c is equal to "DebugTest") then
            delete c
        end if
    end repeat
end tell

However, I'm getting the following error when I run the script, which leads me to beleive that I'm not deleting the configuration correctly:

Xcode got an error: AppleEvent handler failed. (-10000)

Thanks!

+2  A: 

try this...

tell application "Xcode"
    set targetProject to project of active project document
    tell targetProject
        delete (first build configuration type whose name is "DebugTest")
    end tell
end tell
regulus6633
Worked flawlessly. Thank you!
Reed Olsen