-- For some reason this reliably leads to connecting to the bluetooth speaker
tell application "Bluetooth Setup Assistant"
activate
delay 3
quit
end tell
-- Toggle usage of Bluetooth speakers
tell application "System Events" to tell the front menu bar of process "SystemUIServer"
activate
delay 1
tell menu bar item 1
click
-- Un comment next line for diagnostic mode
-- set menustuff to entire contents of front menu
-- Specify your bluetooth speaker name here in place of "Creative D200"
tell menu item "Creative D200" of menu 1
click
tell menu item 1 of menu "Creative D200"
click
end tell
end tell
end tell
-- Workaround below: Only when running this script as an application
-- For some reason running this script as an application doesn't perform the final click above, so I added an additional menu click below which cause the previous click to take effect.
-- repeat to add another action
tell menu bar item 1
click
tell menu item 1 of menu 1
click
end tell
end tell
end tell
-- Un comment next line for diagnostic mode
--return menustuff
No comments:
Post a Comment