Ok, then that must be it. UI scripting is definitely less reliable, but but without any programatic interface there isn’t any other way to do certain things.
I’m able to tell which button is which be getting the result of every button of front window. I was able to tell that button 6 on my system is the minimize from the result of properties of button 6 of front window. This is all in the second tell block. It appears that this script will break whenever you upgrade your system. I have a suggestion that I believe is more reliable. tell application "System Events" to tell process "System Preferences" set theButtons to every button of front window repeat with theButton in theButtons if (name of theButton is "Turn Bluetooth On" or name of theButton is "Turn Bluetooth Off") then exit repeat end if end repeat click theButton beep 3 end tell Of course, if they ever change the title of the button, then this will break as well. But, they haven’t ever changed it to my knowledge. Thanks for replying. I really wanted to know more about what was going on and that helped a lot. This is a good lesson on the pitfalls of UI scripting. On Apr 23, 2015, at 11:03 AM, Traci Duncan <our4p...@gmail.com> wrote: No, I’m still in Mavericks. Out of curiosity, how do you know the number of the buttons? Thanks, Traci On Apr 23, 2015, at 7:12 AM, Barry Hadder <bhad...@gmail.com <mailto:bhad...@gmail.com>> wrote: > Hi Traci, > > On my system, button 6 of that window is the minimize button. I would really > like to understand why it seems to be different on your’s. > Are you using Yosemite? > Thanks. > > On Apr 22, 2015, at 11:17 PM, Traci Duncan <our4p...@gmail.com > <mailto:our4p...@gmail.com>> wrote: > > I ended up putting beep3 after the line: click button 6 of window 1 > > It is working like a charm. I think the only thing I would add to improve > it, is make it similar to my toggle wifi script. Where Alex actually says, > wifi on/wifi off. > > The 3 beeps work for now. :) > > Thanks y’all! > > On Apr 22, 2015, at 9:14 AM, Barry Hadder <bhad...@gmail.com > <mailto:bhad...@gmail.com>> wrote: > >> I would put the beep 3 right after the click. >> If you don’t have a slight delay, then it might not work. >> >> Are you trying to toggal bluetooth on and off? If so, I think there may be >> a problem. You might want to change button 6 to button 3. >> >> On Apr 22, 2015, at 10:22 AM, Traci Duncan <our4p...@gmail.com >> <mailto:our4p...@gmail.com>> wrote: >> >> Hi all, I’ve needed to update my toggle bluetooth script & thankfully I >> found one on the web. My question is, in the below script, where would I >> add in a sound effect? Beep 3, something like that. >> 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, >> Traci >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "MacVisionaries" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to macvisionaries+unsubscr...@googlegroups.com >> <mailto:macvisionaries+unsubscr...@googlegroups.com>. >> To post to this group, send email to macvisionaries@googlegroups.com >> <mailto:macvisionaries@googlegroups.com>. >> Visit this group at http://groups.google.com/group/macvisionaries >> <http://groups.google.com/group/macvisionaries>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. >> >> Barry Hadder >> bhad...@gmail.com <mailto:bhad...@gmail.com> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "MacVisionaries" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to macvisionaries+unsubscr...@googlegroups.com >> <mailto:macvisionaries+unsubscr...@googlegroups.com>. >> To post to this group, send email to macvisionaries@googlegroups.com >> <mailto:macvisionaries@googlegroups.com>. >> Visit this group at http://groups.google.com/group/macvisionaries >> <http://groups.google.com/group/macvisionaries>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google Groups > "MacVisionaries" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to macvisionaries+unsubscr...@googlegroups.com > <mailto:macvisionaries+unsubscr...@googlegroups.com>. > To post to this group, send email to macvisionaries@googlegroups.com > <mailto:macvisionaries@googlegroups.com>. > Visit this group at http://groups.google.com/group/macvisionaries > <http://groups.google.com/group/macvisionaries>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > Barry Hadder > bhad...@gmail.com <mailto:bhad...@gmail.com> > > > > > -- > You received this message because you are subscribed to the Google Groups > "MacVisionaries" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to macvisionaries+unsubscr...@googlegroups.com > <mailto:macvisionaries+unsubscr...@googlegroups.com>. > To post to this group, send email to macvisionaries@googlegroups.com > <mailto:macvisionaries@googlegroups.com>. > Visit this group at http://groups.google.com/group/macvisionaries > <http://groups.google.com/group/macvisionaries>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "MacVisionaries" group. To unsubscribe from this group and stop receiving emails from it, send an email to macvisionaries+unsubscr...@googlegroups.com <mailto:macvisionaries+unsubscr...@googlegroups.com>. To post to this group, send email to macvisionaries@googlegroups.com <mailto:macvisionaries@googlegroups.com>. Visit this group at http://groups.google.com/group/macvisionaries <http://groups.google.com/group/macvisionaries>. For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>. Barry Hadder bhad...@gmail.com -- You received this message because you are subscribed to the Google Groups "MacVisionaries" group. To unsubscribe from this group and stop receiving emails from it, send an email to macvisionaries+unsubscr...@googlegroups.com. To post to this group, send email to macvisionaries@googlegroups.com. Visit this group at http://groups.google.com/group/macvisionaries. For more options, visit https://groups.google.com/d/optout.