how do you mute sounds in an applicaion

i am writtung a mail application that checks email. Every time it runs it make a beep. How can I mute these when my script runs, or just mute mall all together? I know you can do it in oreferences, but I dont want to do it that way. Thanks

doc:

As you know, you can set most applications in their preferences pane for sounds or no. If you only want to mute them for a short period, use this:


set volume alert volume 0

The alert volume can be set anywhere from 0 to 100 (see the dictionary under Standard Additions). I would recommend re-setting the alert volume to something around 80 or 90 after the script has run so that you will still hear it when in the Finder.

Changing the alert volume should not alter the system volume, so you can still play music without any beeping going on in the background.

Good luck,