on turnBluetooth()
tell application "System Preferences"
activate
set current pane to pane "Bluetooth"
--enabling bluetooth
tell application "System Events"
if UI elements enabled then
tell tab group 1 of window "Bluetooth" of process "System Preferences"
click button 1
end tell
end if
end tell
end tell
tell application "System Preferences" to quit
end turnBluetooth
my turnBluetooth()
Source: https://habr.com/ru/post/58478/