Hey all,

I just wrote out a script that lets me choose the document language with keystrokes. It's dead-simple, but I do this enough to make it worthwhile. I hope someone else can find it useful.

tell application "BBEdit"
        try
                set cur_lang to source language of first window
                
set desired_lang to choose from list {"PHP", "HTML", "VBScript", "Perl", "XML", "(none)", "(automatic)"} with prompt "Select document language" with title "Choose Language" default items {cur_lang} with empty selection allowed without multiple selections allowed
                
                set source language of first window to desired_lang
                
        on error
                display dialog "There is no window"
        end try
end tell

The prompt supports typeahead too, so you could potentially fill this thing up with all your available languages and get typeahead access to all of them. I don't think there's a list of installed source languages available to Applescript, or I would have used that.

Note: I've only tested this in BBEdit 8 and Mac OS 10.4.5. I think it should work in a variety of versions, though.

Joe

P.S.  I don't want your pity for having VBScript in that list. :)
--
Joe Chellman
http://www.chellman.org/
http://www.chellman.org/pgp_key.txt


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to