Unmute Sound

Hi =) I have a script that I have been working on for a few weeks. With a LOT of help from the wonderful people on this forum, I finally got it to work. Then I found out it doesn’t work all the way. I am using the script on OS 10.2.8 and it is made in AppleScript 1.9.

I want the script to run in the background, alert when the mouse has been unplugged by a really annoying voice and then log out. I found out that if the sound is muted then it won’t be loud and annoying. This is not good =( Here is the script that I have.

on idle
	global the_script
	set the_script to "ioreg -l | grep  '\"HIDDefaultBehavior\" = \"Mouse\"'"
		do shell script the_script
		beep 0
	on error
		beep 5
		tell application "Finder" to set volume 7
		say "HelpMeHelpMeHelpMeHelpMe! The Mouse is unplugged!" using "Good News"
		beep 5
			ignoring application responses
				tell application "loginwindow" to «event aevtrlgo»
			end ignoring
		on error mes
			display dialog "Error: " & mes giving up after 10
		end try
	end try
	return 30
end idle

I have searched and can not find a way to tell it to turn off mute. I should have logged them all to put, but I didn’t think it would take so long to figure out. When I try this

set volume without output muted

I get an error saying

Expected “given”, “with”, “without”, other paramater name, etc. but found identifier.

Any ideas on what to do?

Thanks =)

Kai mentioned it briefly in the “not recording” thread:

This is confirmed by the release notes.

Using the old volume syntax seems to turn off muting:

set volume 4 -- an integer from 0 to 7

However, the user will have to manually change the volume back later.

If the sound is muted

set volume 4 -- an integer from 0 to 7

will turn up the volume, but it won’t unmute it.

I posted about

set volume without output muted

because I thought someone else might have an idea of what else to try. Not because I tried it even though Kai said it wouldn’t work. I was trying to give more information

( get an error saying

Expected “given”, “with”, “without”, other paramater name, etc. but found identifier.)

so that it might help people to remember if they have ever tried something like that.


It does unmute the volume on my machine.

I wish it would on mine. What kind of machine are you using? I am on an iMac/500 MHz/Power PCG3/128MB with OS X 10.2.8. I push mute on the keyboard and then run the script and it doesn’t unmute it. It will turn the volume up, but because it is on mute you can’t hear it. I have tested it on a few different speeds of machines, but they are all iMacs with the about the same memory and 10.2.8.

Thanks =)

Hi, SWeet.

I can confirm that unmuting the sound using the ‘set volume’ command doesn’t work in Jaguar. For a few years, I’ve been using a couple of scripts that mute the sound on shutdown and restore the volume on (ie. after) startup, so that the startup chime doesn’t attract attention in public places or annoy the neighbours. I was very disappointed when I found I couldn’t restore the volume on my Jaguar machine except by using the on-screen slider, though I’ve learned to live with it. But whatever the problem was has now been fixed and everything works as expected in Tiger.

Glad you turned up, Nigel. I was hoping you’d share the experience of that trusty old Jaguar machine of yours. (I can go back to Mac OS 9, but I currently don’t have a 10.2 machine around.) Using the earlier syntax also unmutes the sound automatically on my Tiger machine. (It even unchecks the mute checkbox in the Sound Prefs pane, if it’s still open.)

I just tried using set volume 4 in OS 9.1, and it works there in exactly the same way as in Jaguar (the volume changes, but mute sticks). The most likely explanation is that the change in behaviour occurred when the new volume commands were introduced in Standard Additions 1.9.4. (All very interesting, but of scant consolation to poor Connie here.) :confused:

I spent a bit of time today looking around for third party applications and scripting additions that might do the trick. Found a few that also change the volume (with different commands) - but nothing to switch muting. Sorry, Connie - doesn’t look too promising right now. I’ll certainly shout if I see anything that looks likely, though…

Thanks for all the work you guys have been doing =) I took the weekend off and didn’t turn on the Mac I took home from work. I spent the weekend being lazy and spending time with my family.

The only way that the sound can be muted is a key on the keyboard. I changed the permissions for the System Folder from Read and Write to No Access. This keeps the kids from changing a lot of things and saves me a lot of time fixing things. I thought about taking the key off the keyboard, but then I thought that keys would start disappearing all over the place.

Is there any way to disable the key? I don’t care if they can mute it or not. I don’t think turning it all the way down mutes it. Maybe I can put some paper under the key… I’m really getting desperate, huh?

Thanks to all of you for trying to help me =)


Hi Connie.

Given the situation in which your Macs are being used, putting the System folder’s permissions safely out of reach seems like a very good idea.

Your assumption about the difference between muting the sound, and setting the output volume to zero, is quite correct. (Although the latter is sometimes referred to as “muting”, it’s really just a kind of simulated mute.) As we’ve now learned, resetting the volume via a script won’t affect the mute setting on your machine(s). But it should override any current volume setting, regardless of whether or not it was previously set to 0.

So, since we haven’t been able to disable mute using software, maybe we should look at some of the possible hardware options. Physically disabling the mute key itself seems like an excellent idea to me (although I hope we can come up with an improvement on the paper-under-key method). :wink:

Like you, I’d have serious reservations about removing a key cap from the keyboard. (I’ve no doubt that enquiring young minds would be bound to regard this as an action worth emulating - and, sooner or later, some enterprising little tinker is bound to discover that a pointed object inserted into the gap could still work.)

My guess is that we might be dealing here with the Apple iMac “500” Indigo model (or similar) - in which case the keyboard is likely to be the Apple Pro Keyboard (or possibly the black-key M7803 version).

Many keyboards (including, if I remember correctly, the above models) are known as dome-switch keyboards - due to the type of key mechanism they use. Beneath each key cap is a kind of rubbery-plastic, dome-shaped ‘bubble’. When a key is depressed, a built-in plunger in the dome is pushed downwards, forcing a connection between some circuit-printed membranes within the keyboard. (Subsequently, when the key is released, the dome springs back into shape, returning the key cap to its original position.)

And the point of all this?

Well, if a dome is removed, then so is the functionality of the corresponding key. (If possible, it would be preferable to remove only the plunger part of it - since this should ensure that the key cap is still retained in the correct position.)

Now - I’ve had to take apart one or two keyboards in my time (don’t ask - they’re all long stories). While a good deal of care is necessary, it’s not an impossible task. Rather than take up a couple of pages here, trying to explain the process, perhaps I can refer you to an illustrated article that describes the disassembly of an Apple Pro (M7803) Keyboard in some detail.

Of course, I’d understand if you felt a bit daunted by the prospect of such an operation - even though it’s not quite as difficult as it may seem. Perhaps you know of a tame techie in your area who might be willing to assist? (Naturally, I’d offer to help myself - but I have a feeling that the travelling involved might be somewhat disproportionate.) :wink:

Anyway, thought I’d just mention the idea as a possibility…

Thanks!!! My son was sick yesterday so I haven’t checked my email or the board. I am not sure which keyboard it is. It has the black keys though. My husband is very savvy at stuff like that, so I am going to take a few keyboards home each night and hopefully this will solve my problem. Thank you so much for helping me =)