BBEdit Session Restore
Sat Dec 09, 2006 · 223 words

BBEdit's probably my most important tool. Even though an editor is such a basic thing that it's almost kind of silly to be attached to one, you just get used to it over time and it's nice to constantly be finding new features and ways to use a tool.

I can easily have upwards of 20 documents open simultaneously - sometimes part of the same project, mostly not. This makes you weary of actually closing the app because what if you want to pick up exactly where you left off? Well, luckily, like so many things in life, this problem too can be solved with a little bit of AppleScript:

property theDocuments : {}



tell application "BBEdit"

  if (count of document) is greater than 1 then

    set theDocuments to file of every document as list

  else

    open theDocuments

  end if

end tell

Just run that after and before every session you want to restore. If you have documents open, it'll save them, if not, open the ones you had open the last time. It's very crude but gets the job done for now. Naturally they don't work with Trasmit links etc because those are just temporarily open.

Properties are wonderful in AS because they are reinitialised only when the script is compiled. That makes them perfect for any kind of “temporary” persistent storage.


back · essays · credits ·