I have spent the day doing various ant builds. I leave the build running and sometimes don’t notice that it has finished or failed along the way.
prompt> (CALL ant dist && (echo ^G)) || (echo ^G^G^G)
and this will sound a one bell (control G) if the command succeeded and two bells if it fails. Note the use of the CALL command; this is necessary because ant is a batch file and if you don’t use CALL it does not return properly and the conditional operators do not work.
But I promised you rich wav sounds not crude beeps. We can do that too thanks to Eli Fulkerson who wrote sounder.exe
This is a small console program that can be invoked to play a .wav file from the command line. As compiled, it will only play the first 2 seconds of the .wav and then exit, but that’s tweakable in the source. It was written simply to provide audible alerts from windows batch files.
This runs fine on my 64 bit Windows 7.
Simply copy some .wav files from your Windows directory. I like chord.wav for errors and chimes.wav for success.
prompt> (CALL ant dist && (sounder.exe chimes.wav)) || (sounder.exe chord.wav)
and then for optimum reuse create some batch files giving
prompt> (CALL ant dist && (beep-success.bat)) || (beep-error.bat)
where these files are in C:\batch and this has been added to your path.
The final example above works fine unless you want to include this line in a batch file. If you do you will find that the next line of the batch file does not run. This is because control of execution does not return from a batch file unless you use CALL. Therefore
prompt> (CALL ant dist && (CALL beep-success.bat)) || (CALL beep-error.bat)
is better for reuse.