Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set DeviceName to "Your Device"
- 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" then
- click menu item "Connect"
- 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
Add Comment
Please, Sign In to add comment