Deleting items without sound

I have a script that deletes several items.
Every time an item is put in the trash I hear a sound.
How do I do this without sound?
I tried the following but it doesn’t work:

tell application "Finder"
	delete file "Mac OSX:Users:XXX:Desktop:8ball.tif" without sound
end tell

does this work?

tell application "Finder"
	set volume alert volume 0
	delete file "Mac OSX:Users:XXX:Desktop:8ball.tif"
end tell

That should work just fine, and remember that unless you reset the number to 70 or 80 later in the script, you will hear no alert beeps at all, in any application after the script has executed. I believe that whatever setting you choose will remain the default, even after the machine is shut down and re-started later.

Have you found this to be the case, bonedoc?

You know, I havnt noticed yet, because the script I used it in placed it in a repeat. I think that is true though. I am not hearing the sound I muted within that app, but I hear it in other apps.


If you want to remove the trash sound completely, then replace this file:

Macintosh HD:System:Library:Components:CoreAudio.component:Contents:Resources:SystemSounds:dock:drag to trash.aif

with one that doesn’t make sound.


That did the trick, thanks!

It’s good to know where the files for system sounds are being kept, if they annoy me in the future I can get rid of them.

Good point, Craig.

This should silently delete the current Finder selection - and then restore the previous volume setting:

tell application "Finder"
	set v to alert volume of (get volume settings)
	set volume alert volume 0
	delete selection
	set volume alert volume v
end tell

beep (* merely to demonstrate the restored volume *)

I just assumed you couldn’t get the current volume settings and that’s why the previous scripts didn’t contain the commands to get them.
It makes complete sense if you can set it, then you can also get it.
Thanks for the extra info.