The following code works for Project Builder. I put it in a file called pb in ~/bin (make it executable and type 'rehash' to use) and it works just liked bbedit!
#!/usr/bin/perl[The last line is shown on two lines; enter it on one with no spaces.]
my $create = 0 ;
foreach (@ARGV)
{
if($_ eq "-c") {
$create = 1 ;
}
else {
$filename = $_ ;
}
}
if (! -e $filename )
{
chomp $filename ;
if($create) {
system "touch $filename"; }
else
{
print "$filename doesn't exist. Specify -c to create.n" ;
exit ;
}
}
elsif( $create == 1 )
{
print "$filename already exists. Cannot create.n" ;
exit ;
}
system "open -a /Developer/Applications
/Project\ Builder.app $filename" ;
I'm no perl expert, so feel free to make any suggestions in the comments on how to shrink or improve this code. The one thing about this versus how bbedit works, or programs such as emacs, is because I use touch to create the file, it is created even if you never add anything to the file and close it immediately.
By the way, this would be pointless for many applications and file types, as open will open it automatically in the application you want. But, if you switch between bbedit, project builder, emacs, etc., you may not want a .cpp file to open in the same application.

