Command Lines and Window(s) and BBEdit

| | Comments (0)
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.] use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on September 20, 2004 10:26 PM.

Washington Primary System was the previous entry in this site.

Yousef Islam is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.