Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: 4ian on February 22, 2010, 05:27:45 pm

Title: Playing a sound when compilation has finished/failed
Post by: 4ian on February 22, 2010, 05:27:45 pm
Hello,

I'm looking for a way to get Code::Blocks to play a sound when compilation has finished or has failed.
Sometimes, compilation process can take a while, and having a sound played when the process is finished could help. ( For instance, I often do something else, as go on internet ).
Do you know if there is any way to do this currently ? Maybe it could be a good idea to add such an ( optional ) feature to Code::Blocks ( using wxSound for example ).
Title: Re: Playing a sound when compilation has finished/failed
Post by: killerbot on February 22, 2010, 05:48:09 pm
first thing that comes to mind : post build step that launches your favorite mp3 player software and you give the mp3 to play as a command line argument to the player
Title: Re: Playing a sound when compilation has finished/failed
Post by: 4ian on February 22, 2010, 06:27:00 pm
I've tried to add : "Execute("MyProgram.exe");" to post-build steps, but it does not seems to work. ( Post build steps aren't Squirrel scripts maybe ? ).
Title: Re: Playing a sound when compilation has finished/failed
Post by: Jenna on February 22, 2010, 06:53:07 pm
I've tried to add : "Execute("MyProgram.exe");" to post-build steps, but it does not seems to work. ( Post build steps aren't Squirrel scripts maybe ? ).

No, the commands you type there are just executed in the default shell.
In your case just use "[path_to]MyProgram.exe"

See the manual for more details: http://www.codeblocks.org/docs/main_codeblocks_en.html (http://www.codeblocks.org/docs/main_codeblocks_en.html)
Title: Re: Playing a sound when compilation has finished/failed
Post by: 4ian on February 22, 2010, 08:08:12 pm
Indeed, it works well with a command line like "c:\Program Files\VideoLAN\VLC\vlc.exe C:\Windows\Media\chimes.wav --play-and-exit". :)
Alas, when compilation fails, the post build steps aren't run..
Title: Re: Playing a sound when compilation has finished/failed
Post by: killerbot on February 22, 2010, 10:18:52 pm
we should have some variable that contains the end result of compilation, which could be made available then (for scripts, plug-ins).
@Yiannis, Martin : the gurus of variables : is this possible, or does it already exist ?