Can't we all just get along?
Like a lot of folks these days I write all my Objective-C code, like I write my Ruby code, using TextMate instead of Xcode. Xcode has more tricks these days but they don't much up for it's deficiencies and, well, there is an argument for having one editor and knowing it well.
However I still use Xcode to manage my project files & dependencies and to build & run my code (even if I am starting to use command-line gdb because it seems more reliable that way). I find the Xcode build results easier to use than the built-in TextMate approach and Xcode knows how to manage Cocoa projects and their dependencies.
Up until now I've been writing in TextMate then switching to Xcode and hitting Cmd+B, Cmd+R, or Cmd+Y depending on whether I want to build, run, or debug. But it irked me because I would keep using Cmd+B in TextMate. To begin with this would trigger TextMate's use of xcodebuild which annoyed me and I quickly disabled that.
This morning in one of those facepalm moments it occurred to me to ask why I hadn't checked if Xcode was Applescriptable. Of course, it is.
So one script (saved as ~/Applications/BuildWithXcode.scpt) later:
tell application "Xcode"
activate
build
end tell
tell application "TextMate"
activate
end tell
and I have Cmd+B bound to oscript ~/Applications/BuildWithXcode.scrpt and I'm away. Similar for run and debug:
tell application "Xcode"
activate
launch
end tell
TextMate and Xcode working together nicely.
Update: My run script wasn't working because I used run instead of launch. I guess the app must already have been running without me noticing. Works now though :)
