I am trying to write an applescript that will serve as an alarm clock, but I am not sure how to mute/unmute the system. I need something that will check to see if the system is muted, and if it is, to unmute. I tried this, which did not work:
if (get mute) = false then
set mute to not (get mute)
end if
presumably, ‘get mute’ returns a false flag if the system is muted, so negating it should make it true - but apparently not.
Not quite, vgoklani. If the sound is muted, then iTunes’ mute property will be true.
So your script works like this: If the mute property is false (and the sound can therefore be heard), then your script will set mute to true (to silence the sound). If mute is true (and no sound can be heard), then the script does nothing.
To toggle the mute property, try something as simple as:
tell application "iTunes"
set mute to not mute
end tell
Oh, it appears that I have made a mistake - the mute in iTunes is not tied into the system mute! Is there a way for me to control the system mute function (the one where you can mute the sound by pressing a button on the keyboard).
Yes - the method requires at least Standard Additions 1.9.4, which was actually included with Mac OS 10.3.5 - and which requires Mac OS 10.3 or later. (Before that, I used Jon’s Commands to achieve something similar.)