On Nov 9, 2009, at 5:51 PM, DeNigris Sean wrote:
Hi list,
1. Is there a way to create a new project via Applescript? The last answer I could find was from years ago.
I ended up using UI Scripting for now. Feel free to use it...
to make_new_project(project_name)
tell application "Xcode" to activate
tell application "System Events"
tell process "Xcode"
click menu item "New Project…" of menu 1 of menu bar item "File" of menu bar 1
tell window "New Project"
-- row 8 is empty project, 4 is Cocoa App
select row 4 of outline 1 of scroll area 1 of splitter group 1 of group 1
click button "Cocoa Application" of radio group 1 of scroll area 1 of splitter group 1 of splitter group 1 of group 1
click button "Choose…" of group 2
tell sheet 1
key code 5 using {command down, shift down} -- g key
tell sheet 1
set value of text field 1 to "[path/to/project/]"
click button "Go"
end tell
set value of text field 1 to project_name
click button "Save"
end tell
end tell
end tell
end tell
end make_new_project
2. Does anyone know of a good reference/tutorial one Xcode's applescript-ability?
I'm still looking for one, but I learned a lot creating my script, so I created an Xcode handler library. It's long, so here are the links to the code on my blog:
script that uses the library handlers to set up a new C++ project in Xcode for BDD testing