I’ve noticed with AS 2.1.1 (in Mac OS 10.6.2) on my new MacBook Pro that when the ‘beep’ command has a number parameter ” say ‘beep 5’ ” the first three beeps all sound together. I hear a splurged first beep and two fewer beeps than I’m expecting. But if I run the script again after not too long an interval, I hear the correct number of distinct beeps. I don’t know if this is a bug in ‘beep’ or something peculiar to my system.
My work-round is to have the script beep once with the sound muted and then perform the required multiple beeps with the sound level restored:
on multibeep(n) -- Hack to get round a 'beep n' bug in Snow Leopard.
set outVol to output volume of (get volume settings)
-- Mute the output volume and beep once to "wake" the 'beep' command.
set volume with output muted
beep
-- Restore the output volume and do the required multibeep.
set volume output volume outVol
beep n
end multibeep
multibeep(5)
It would be great to use a beep handler to intercept the normal ‘beep’ call:
on beep n -- Hack to get round a 'beep n' bug in Snow Leopard.
set outVol to output volume of (get volume settings)
-- Mute the output volume and beep once to "wake" the 'beep' command.
set volume with output muted
continue beep
-- Restore the output volume and do the required multibeep.
set volume output volume outVol
continue beep n
end beep
beep 5
. but while this works well in AppleScript Editor, it causes a “privilege violation” error when used in a stand-alone applet.