5
6
I'm trying to create an applescript to allow me to connect to a bluetooth device by it's Bluetooth ID.
So far, i've managed to get an applescript to turn on bluetooth if it's off. Here's the code:
# This is only necessary, if AppleScripts are not yet allowed to change checkboxes
tell application "System Events" to set UI elements enabled to true
# Now change the bluetooth status
tell application "System Preferences"
set current pane to pane id "com.apple.preferences.bluetooth"
tell application "System Events"
tell process "System Preferences"
# Enabled is checkbox number 2
if value of checkbox 2 of window "Bluetooth" is 0 then
click checkbox 2 of window "Bluetooth"
end if
end tell
end tell
quit
end tell
Would someone know if and how it's possible to set up a new bluetooth device and if it'd be posible to connect to a device based on it's device name/ it's device bluetooth ID?
I've also tried to record the action in Automator but for the "set up new device" option, Automator just tells me: "click on "" button". Thanks
1
Please check this.
– mu3 – 2017-10-15T16:35:00.550@mu3 can you add that as an actual answer? I almost missed that there's a solution to this question. – Jared – 2018-03-28T19:50:12.503
Found your question via Google because I'm hoping to find a solution as well. If I have any luck I'll be sure to post an answer here (though things aren't looking promising). – Wilco – 2013-10-01T23:15:15.127