在新的BBEdit文本窗口中一起打开文件,Redux

早在9月,BBEdit 8.0发货后,I posted an AppleScriptyou 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 drawerThe choices in BBEdit 8.0 were to either open each document in its own window (i.ethe traditional multi-window behavior BBEdit has always offered), or you could always have documents open within the current frontmost window.

我用脚本Ranchero的大猫脚本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开放参数打开命令你的选择开放目标是front_windowseparate_windows,以及我们想要的那个:新窗户

这是脚本的新版本:

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

(该主要handler is a Big Cat Scripts idiom; see theprevious article有关使用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更新了他的Perl版本相同的脚本,并提供了一堆使用的技巧的BBEdit命令行工具。