Going crazy trying to set the sound volume

I have tried far too many different variations to keep track of to get a script to set the system sound volume to mute when I do a shut down, and then back to maximum once it starts back up.

I can get a script to set the volume to 7 when I start up. But no script that I write will turn the sound off before shut down. I tried putting these various scripts in the shutdown items folder. But they just don’t seem to work. Does AppleScript shut off before the shutdown items are run?

Jmax

Ok, 1 minute after I posted this I tried one more thing and it worked. Please ignore this topic — and quit that laughing.

Jmax :oops:

Beep?

Don’t be embarrassed. If you discover a cure for a problem you’ve posted, perhaps you should post it here in case it helps someone else. :slight_smile:

A sound has to be made before a volume change comes into effect. I presume your ultimate intention is to mute the startup chime. As far as I know, this only works on portable Macs, not desktop models - but portables are where it’s needed, of course. Desktop models are unlikely to be started up in trains or other public places!

Actually, I just couldn’t figure out what was choking my script. It turned out to be the word “to”.


tell application "Finder" to set volume to 0

That’s the wrong way.


tell application "Finder" to set volume 0

That’s the right way. I cannot believe that I tried so many variations and never just took that word “to” out.

You are right as to my reasoning. The reason I want the sound to go off at shutdown and come on after start up is that I start up the computer - which is in my bedroom at 4 or 5 AM and my wife is still asleep. If it bongs too loudly it wakes her. And since my output is run through an amplifier, IT BONGS LOUDLY!!! :smiley:
My sons also turn the sound down from within games without realizing that they are doing it. And then I cannot hear anything when I start up the computer.

BTW, it does work. There is no startup sound. But when I do anything - such as play music (with the headphones) the sound is maxed out in the control strip. Just like I like it.

Wow, I am freakin’ chatty tonight!

Jmax

I wrongly guessed what had happened. :wink:

I was thinking of a problem that came up on the AS-Users mailing list a couple of years ago, when someone complained that setting the volume (to) 0 in a shutdown script didn’t mute the startup chime. Someone else pointed out that zeroing the volume only muted the chime on PowerBooks, not on desktop models.

I’d never heard the startup chime on my desktop 4400 because it has an AV monitor. The monitor’s sound jack physically cuts out the 4400’s own speaker and the drivers for the monitor’s speakers aren’t loaded until after the chime has sounded - if “sounded” is the right word here. But the chime on my then-new Pismo (G3 PowerBook) was proving an embarrassment on the road and so the thought of such a shutdown script was very appealing.

It turned out that sound level changes weren’t remembered at shutdown unless a sound had been played first, so the final script was:

set volume 0
beep

Both commands are from the Standard Additions and don’t need a Finder ‘tell’ block. The beep isn’t heard because it’s played at zero level, but it causes the PowerBook to remember that level when it starts up again. I have a similar script in my Startup Items folder to restore the volume to a modest degree of audibilty. The beep is both unwanted and unnecessary in this case.

I’ve recently also installed OS X on my PowerBook. X doesn’t accommodate shutdown items, so I’m going to have to use two modified scripts - one that zeros the volume and then shuts down the computer, and another that zeros the volume and then restarts.

I’m quite chatty myself this morning. :slight_smile: