Shut down & mute...

display dialog " Are you sure you wish to shut down?"
--mute the volume
set volume 0
--shut down OS X
tell application "Finder"
	shut down
end tell

Have created this script as a member on macrumors forums had the same issue I’ve had, whereby you have been listening to music load during the day, you go out come home & turn the mac on & the startup sound plays at full blast waking up people in bed or scaring the hell out of you. The good thing is that if anything needs saving it will ask…

Found a .pref to shut the sound off on start up, but don’t trust downloads. Looking to sort it my self.

Hope you enjoy…

Hi.

You can also write a script applet to restore the volume to your preferred setting, which can be installed as a start-up item. It’ll run after the muted chime has (not) sounded.

I already do this using login and logout scripts… so it’s all automatic. Here’s how:

  1. Create a plain text file with the following as the login script:
  1. Create a plain text file with the following as the logout script:
  1. Save the scripts in /usr/local/bin as loginscript and logoutscript, respectively.

  2. Run the following Terminal commands to give the scripts execute permissions:

  1. Run the following two Terminal commands to create the login and logout hooks:

That’s it! Now when you log out the volume will be muted such that when you restart you won’t hear the startup chime. When you log in your volume will be unmuted.

To remove these changes, type the following commands in Terminal:

Hello regulus6633

I followed your guidelines to make my Mac not play the startup chime. However, I failed at step 4.

The Terminal then returned me a list of how to use “chown”. According to your description, shouldn’t it be “chmod” instead?

I found that even if I changed it to “chmod”, the actions completed successfully in Terminal, but it doesn’t have any effects. Any idea?

Model: Mac mini 2nd generation
AppleScript: 2.0.1
Browser: Safari 530.17
Operating System: Mac OS X (10.5)

Yes, you’re right of course. I changed my post to reflect that.

After you make all the changes, run this in the Terminal…
sudo defaults read com.apple.loginwindow

That will read the right file and your login and logout hooks will be listed. It will show you the path to the executable file for each hook so make sure that’s right. Note: you have to use sudo in the command or they won’t be listed because it reads a different file. So if they’re listed then they’re working. In the same manner, you had to use sudo with the commands to make sure the hooks are written to the right file. There’s several com.apple.loginwindow files on your computer and if you don’t use sudo then the hooks aren’t put in the proper file.

The only other thing you can double-check is to make sure you’re executables are working. See if they mute and unmute your volume. Just type their path into Terminal and see if they work.

Hi.

Now I am completely frustrated. I have followed your suggestions, and ran sudo defaults read com.apple.loginwindow, and the returned results seem ok:

And when I entered the scripts in Terminal, my output volume was really set to mute. However, for some reason, I still couldn’t get this working. And I have no idea why.
I don’t know but could there be something else which stopped the execution of the scripts? I am trying to debug this problem by writing a log out script that creates a folder on my hard disk and I will see if that works.

I have been busy recently and may not reply immediately. Sorry.

Kim

Model: Mac mini 2nd generation
Browser: Safari 530.17
Operating System: Mac OS X (10.5)

If those two things are correct then I’m not sure what the problem could be. Maybe it’s a permissions thing??? I doubt it but you never know. Check your console log for messages, maybe there’s some error message in there.

You could also put a line in your login/logout scripts to write to a log file. That way you could check the log file after a restart and see if your two scripts did anything. Here’s some unix code you could use to write to a log file. Note this example creates a log file on your desktop with the log message from the echo command. Messages are appended to the end of the file so if you restart your computer then you should get a log message from each script in the log file.

One other thing. It’s not necessary to keep those files in /usr/local/bin. You could put them anywhere on your computer… just make sure the path to them is correct when you create the hooks.

Hello.

I finally figured out what really happened. Actually, when we execute

set volume with output muted

, the volume of the current in-use device is set to mute. As I usually have my microphones plugged in, this sets the volume of my microphone to mute. However, the startup chime is always played by the internal speakers, which I never use. So what I needed to do is just to plug out my microphones, set the volume of built-in output to mute and plug my microphone back in. That’s it.
Thanks anyway.
Kim