Hello! I love ToothFairy for connecting to my headphones… I was wondering if there was any chance of adding support for one-click connection to my iPhone’s Bluetooth Personal Hotspot?
This would be the equivalent of choosing this menu item:
You can do this by setting a “Run shell script after connecting” script in ToothFairy. Then when you click the icon, it will connect to the hotspot. The script could look something like:
#!/bin/sh
osascript << EOF
set DeviceName to "Tom's iPhone"
tell application "System Events" to tell process "SystemUIServer"
set bt to (first menu bar item whose description is "bluetooth") of menu bar 1
click bt
if exists menu item DeviceName of menu of bt then
tell (first menu item whose title is DeviceName) of menu of bt
click
tell menu 1
if exists menu item "Connect to Network" then
click menu item "Connect to Network"
return "Connecting..."
else
key code 53 -- hit Escape to close BT menu
return "No connect button; is it already connected?"
end if
end tell
end tell
else
key code 53 -- hit Escape to close BT menu
return "Cannot find that device, check the name"
end if
end tell
EOF