Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

pudge
  (email not shown publicly)
http://pudge.net/
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Tuesday September 21, 2004
12:26 AM

Command Lines and Window(s) and BBEdit

[ #20977 ]

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.]

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.