This answer is very similar to @Wolph answer; however, after struggling with other problems, this is what I ran into. I like this for two reasons: # It will not disconnect the device if it is already connected # Good output from osascript
Just save it to a file and call osascript path/to/file.applescript
This has been working on OSX Mavericks 10.9.2 since April 11, 2014, although you may need to provide access to any method that you use to run it in the security settings panel. See This is Apple KB: http://support.apple.com/kb/HT5914
All you have to do is change the line "LG HBS730" to the name of your device and you should be installed. Refunds there, so you get a good result from osascript .
activate application "SystemUIServer" tell application "System Events" tell process "SystemUIServer" -- Working CONNECT Script. Goes through the following: -- Clicks on Bluetooth Menu (OSX Top Menu Bar) -- => Clicks on LG HBS730 Item -- => Clicks on Connect Item set btMenu to (menu bar item 1 of menu bar 1 where description is "bluetooth") tell btMenu click tell (menu item "LG HBS730" of menu 1) click if exists menu item "Connect" of menu 1 click menu item "Connect" of menu 1 return "Connecting..." else click btMenu -- Close main BT drop down if Connect wasn't present return "Connect menu was not found, are you already connected?" end if end tell end tell end tell end tell
Andrew Burns
source share