/**** This is a translation by Google ****/
Hello,
I seek an explanation for the use of build scripts in Code::Blocks.
Work environment:
- OS: Vista Basic Pack 2
    Mingw32 with TDM-GCC 4.4/4.5 Series
- Tools: Code:: Blocks 10.05 rev 6283 with wxWidgets unicode 2.8.10
    Squirrel, integrated scripting language and adapted to C::B
problem:
I'm building a C++ console application with the wizard without any modification (generation and execution right).
I would add to the project (not targets) a script designed to illuminate the behavior of C::B when generating the project.
(generation and execution ... right).
This is the only project in project tree
Help with site scripting code:: blocks
- Base page:
http://wiki.codeblocks.org/index.php?title=Category:Scripting_Code::Blocks- Build scripts:
http://wiki.codeblocks.org/index.php?title=Build_scripts- Scripting commands:
"http://wiki.codeblocks.org/index.php?title=Scripting_commands"- Forum
"http://forums.codeblocks.org/index.php/topic,15072.msg100812.html#msg100812"The script in question "Test.script" has only one function automatically called when generating the project:
//-------------------------------------------------------------------
//  test.script
//--------------------------------------------------------------------
// -> The "SetBuildOptions (base)" is mandatory for
//  build scripts, even empty, otherwise invalid script!
//  (Build_scripts see above)
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// This function only produces the display.
//    base =  instance of 'CompilerTargetBase'
//--------------------------------------------------------------------
function SetBuildOptions (base) {
    // The name of the caller
     local nametarget = base.GetTitle();
     local message =  _T(" SetBuildOptions passage from '")  + nametarget  + _T("'") ;   
    // Message in the console script
     print(message);
    // Post by visual
     ShowWarning(message);
    // Red (for readability) in the console 'Code:: Blocks'
     LogError( message );
}
Results of  November 10, 2011:  
A-in the (re)build the project, this function is called
 Before you build the project ...
 - Once with 'base = project'
 After build ...
 - Once with 'base = target'  (in the order of the targets, unless targets 'command')
 (See the sources of the sdk:
  - 
"void CompilerCommandGenerator::Init(cbProject* project)"  and  - 
"void Compiler::Init(cbProject* project)" B-when closing the project or 
C-at the opening of the project or 
D-loading C::B
 ->
 it is called once !  E- if automatic backup of the project every 5 minutes
 -> 
it is called once (unexpectedly!) every 5 min.You can add markers in the project to separate the  stages of any build (scripting language, care to [[..]])
 1 - pre build step :
[[ Log(_T("Begin ")+GetProjectManager().GetActiveProject().GetTitle() );]]
[[ ShowMessage(_T( "  --> Before build ..."));]]
 2- post build step :
[[ local mes = _T("   -->After build");ShowMessage (mes); ]]
[[ Log( _T("End ") + GetProjectManager().GetActiveProject().GetTitle() );]]
//---------------------------------------------------------------------
Can anyone tell me a way to avoid this behavior, at least curious, C::B?