Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Chun Jiu on March 24, 2015, 05:52:39 pm

Title: Will the script can access the global variables for Code::Blocks?
Post by: Chun Jiu on March 24, 2015, 05:52:39 pm
Hi All,

I want to set and read the global variable in the startup script.

Is there any way you can do?
Title: Re: Will the script can access the global variables for Code::Blocks?
Post by: oBFusCATed on March 24, 2015, 06:34:37 pm
Probably you can do it by directly altering the config file using the ConfigManager.

See here for details: http://wiki.codeblocks.org/index.php?title=Scripting_commands
Title: Re: Will the script can access the global variables for Code::Blocks?
Post by: Chun Jiu on March 25, 2015, 03:27:51 am
Probably you can do it by directly altering the config file using the ConfigManager.

See here for details: http://wiki.codeblocks.org/index.php?title=Scripting_commands

ConfigManager only access new global variables for scripts in runtime. Do not know how to access global variables existing in CB.
Title: Re: Will the script can access the global variables for Code::Blocks?
Post by: MortenMacFly on March 25, 2015, 07:06:40 am
There is the global "ReplaceMacros" function exposed for that purpose.
If you call it with a macro it will provide you with the "translation".
Title: Re: Will the script can access the global variables for Code::Blocks?
Post by: Chun Jiu on March 25, 2015, 08:23:07 am
There is the global "ReplaceMacros" function exposed for that purpose.
If you call it with a macro it will provide you with the "translation".

Thank all  :)

I'm looking for ways to add a global variables to cb. Because I want to use a script to replace the target compiler tool chain.
But found replacement target compiler ID can achieve the same purpose.
So, thanks guys  ;)