By John Gruber
Openings for ads on Daring Fireball just like this one. Email for info.
Back in September, after BBEdit 8.0 shipped, I posted an AppleScript you could use to open a bunch of files together in a single new window, which was something you couldn’t do out-of-the-box with BBEdit’s new documents drawer. The choices in BBEdit 8.0 were to either open each document in its own window (i.e. the traditional multi-window behavior BBEdit has always offered), or you could always have documents open within the current frontmost window.
I use the script with Ranchero’s Big Cat Scripts plug-in, so that I can invoke it from the Finder’s contextual menu simply by Control-clicking on the files I wish to open together.
In my original script, I had to go through a few minor contortions to
work around some of the limitations of BBEdit 8.0’s scripting support
for the documents drawer. BBEdit 8.1 (released two days ago) makes
this a lot easier, by adding an optional
opening in parameter to the
open command. Your choices for the
opening in target are
separate_windows, and the one we want:
Here’s the new version of the script:
on main(file_list) tell application "BBEdit" open file_list opening in new_window tell text window 1 set show documents drawer to true set show navigation bar to true activate end tell end tell end main
main handler is a Big Cat Scripts idiom; see the previous
article for more details on using this with Big Cat.)
This script is not only more concise and intuitive than the version from September, but executes a bit quicker as well.
Chris Nandor has updated his Perl version of the same script, and also offers a bunch of tips for making use of the
bbedit command-line tool.