For a long time I have used this AppleScript that I use with Keyboard
Maestro to automatically save the front-most document:

if application "BBEdit" is running then
    try
   tell application "BBEdit"
  tell document 1
save
  end tell
   end tell
    end try
end if

(I use this with Keyboard Maestro so that when BBEdit “deactivates”, the
file will be saved. I have since learned that BBEdit has a feature to do
this itself, but I've been using Keyboard Maestro for a long time, so I
figured I'd stick with it.)

The problems with this are two-fold:

1. If the file has not been saved before, BBEdit will (understandably)
bounce in the dock to tell me to name the file which it is trying to save.
I would rather not bother trying to save as-yet-unsaved documents when
BBEdit deactivates.

2. Perhaps more significantly, this AppleScript only saves the front
document, and I'd really much prefer that it do an “Save All”… but, again,
only for files which can be saved without user-intervention.

Despite all my best efforts, I still don't understand AppleScript very well
(and my efforts at Googling have not been productive), but I assume there’s
a way to accomplish #1, but I can’t figure it out. There must be some way
to tell BBEdit to save if the window title doesn’t start with “untitled
text” or something like that.

I assume that #2 is so complicated as to be un-attainable, but I figured
I’d ask, and hope that maybe someone who is great at AppleScript might have
a chance to prove me wrong ;-)

Thanks for any advice you may be able to offer.

Tj

--
TJ Luoma
TJ @ MacStories
Personal Website: luo.ma (aka RhymesWithDiploma.com)
Twitter: @tjluoma

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to