Command Lines and Window(s) and BBEdit

pudge on 2004-09-21T05:26:06

My sentiments about BBEdit's new feature to allow opening files into the same window are similar to John Gruber's. The difference is, I rarely use the Finder for opening files, compared to how often I use a terminal.

I wrote to Bare Bones asking them to add a feature to the bbedit command line program allowing opening of multiple files to a single window, but in the meantime, I ported John's AppleScript to perl (which also allows it to be used, unchanged, with Big Cat).

#!/usr/bin/perl
use warnings;
use strict;

use Mac::Glue ':all'; my $bbedit = new Mac::Glue 'BBEdit';

my $win = $bbedit->make(new => 'window'); $win->prop('show documents drawer')->set(to => 1);

my $docID = $win->prop(id => document => 1)->get; my $doc = $bbedit->obj(document => obj_form(formUniqueID, typeLongInteger, $docID));

$bbedit->obj(file => \@ARGV)->open(opening_in => $win); $doc->close;


[Implementation note: by default, Mac::Glue would try to guess that the number in $docID is an index (document 1) instead of an ID (document id 1). The obj_form() syntax, while bulky, makes it explicit.]