Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

festermonkey

macrumors newbie
Original poster
Apr 30, 2014
1
0
I'm not a programmer, first off. So forgive my ignorance here. I am trying to disable bluetooth using applescript. My goal is to assign this applescript to my Griffin Powermate button to make it easier to use my iMac as a second screen for my MBP. I have this script, which gets it most of the way, but the problem is in mavericks, if you click the button to turn off bluetooth, you get another window that needs you to confirm that you want to do that. In comes in the form of two buttons, one that says "Turn bluetooth off" and the other that says "Leave bluetooth on".

So I can't for the life of me figure out how to get the script to click the button in the secondary window (like a popup, but it's not modal)

Thoughts?

Here's the current script I have, which works great to turn bluetooth back on, by the way, because there is no secondary window.
Code:
tell application "System Preferences"
	reveal pane "com.apple.preferences.Bluetooth"
end tell
tell application "System Events" to tell process "System Preferences"
	click button 6 of window 1
end tell
quit application "System Preferences"

Thanks so much for your help.
 

Attachments

  • Screen Shot 2014-04-30 at 1.23.23 PM.png
    Screen Shot 2014-04-30 at 1.23.23 PM.png
    80.6 KB · Views: 201
Last edited by a moderator:
edit scratch my command line suggestion its behaviour re bluetooth doesn't seem to be consistent in a script
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.