Is there a way to have BBEdit automatically save files when switching to a different application?

In Sublime Text 2, there is a save_on_focus_lost preference option. When set, every time you switch to another app all current files are saved. Is there a way to make BBEdit behave the same way?


Solution 1:

BBEdit has "Attachement Point" scripts that are automatically run during different conditions. Here is a list of Attachment Points:

http://www.bbeditextras.org/wiki/index.php?title=Attachment_Points

Here is a script that should do what you want:

https://gist.github.com/benspaulding/1287814