Startup script

From Code::Blocks


When Code::Blocks finishes loading, it tries to load a script named startup.script. If it is found it then executes it (no need for "function main()" inside it anymore). The user can edit this script to run arbitrary customization commands on application startup. The shipped startup.script demonstrates a couple of the newest scripting features.

Log(_T("Running startup script"));

// #include any script plugins; this will register them too
// un-comment the line below to register a pointless sample plugin
// Include(_T("sample_plugin.script"));

// add a menu entry to edit this script
GetScriptingManager().RegisterScriptMenu(_T("edit_startup_script.script"), _T("Settings/-Edit startup script"));


Example

An example script is now shipping with Code::Blocks. Please read the last line of the startup.script above:

// add a menu entry to edit this script
GetScriptingManager().RegisterScriptMenu(_T("edit_startup_script.script"), _T("Settings/-Edit startup script"));

This actually binds the script named edit_startup_script.script to the menu entry "Settings/-Edit startup script".

And don't forget that Code::Blocks conveniently allows you to edit the edit_startup_script.script at any time. All you have to do is keep SHIFT pressed while clicking on the "Edit startup script" menu item ;).


See also