Changing colour schemes in BBEdit

An old script that I used to change the colour scheme of BBEdit, based on John Gruber’s BBColors tool. This script is no longer necessary with BBEdit 10. You can, however, download John’s colour schemes and copy them to your “~/Library/Application Support/BBEdit/Color Schemes/” folder and then load them from the Text Colors section of BBEdit’s preferences.

tell application "System Events"
   set bbOpen to (name of processes) contains "BBEdit"
end tell

if bbOpen is true then
   tell application "BBEdit" to quit
end if

set btnSet to {"Cancel", "Light", "Dark"}
set prompt to "Do you want light or dark colours?"
set dlgResult to display dialog prompt buttons btnSet default button {"Dark"}

set btn to button returned of dlgResult
if btn is "Light" then
   set colourFileName to "Defaults"
else if btn = "Dark" then
   set colourFileName to "Gruber Dark"
end if

set shellScript to "bbcolors -load " & quote & colourFileName & quote
do shell script shellScript

tell application "BBEdit"
end tell