Author Topic: Can I set/create environment variables from Wizard Script ?  (Read 4373 times)

Offline kccheng

  • Multiple posting newcomer
  • *
  • Posts: 30
Hi,

Can I set/create environment variables from Wizard Script ?
I'm working on a DLL wizard script.  And I want to set/create some environment
variable for my Host Application so it can find the DLL.
Is it possible ?

I check SetVar() function, which is not what I expected.
Thanks a lot.

Regards,
KC

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can I set/create environment variables from Wizard Script ?
« Reply #1 on: June 02, 2011, 10:02:56 am »
You want to set variables in Environment variables plugin (envvar) оr you want to use something like putenv() C lib function?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline kccheng

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Can I set/create environment variables from Wizard Script ?
« Reply #2 on: June 02, 2011, 11:21:29 am »
You want to set variables in Environment variables plugin (envvar) оr you want to use something like putenv() C lib function?

Either way which can be used in Wizard script.
I want to add (export) some environment variables from my DLL Wizard
which will be available when user click "Build->Run" or "Debug->Start" to
launch my host application.

My application will search a special path for DLL.  The default path could be
changed by environment variable MYAPP_DLL_DIR.

What I want is set MYAPP_DLL_DIR (at the time user create the project
via my Wizard) to the target output dir so the host app
can find the DLL created in C::B by default.
Is that possible ?

Regards,
KC
« Last Edit: June 02, 2011, 11:23:10 am by kccheng »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can I set/create environment variables from Wizard Script ?
« Reply #3 on: June 02, 2011, 12:40:03 pm »
kccheng: Take a look at the envvar plugin. It does what you want in terms of features (you can set env variables, when your applications is executed from inside C::B).
I'm not sure how scriptable it is, probably not much, but it could be made. It is not that difficult.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline kccheng

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Can I set/create environment variables from Wizard Script ?
« Reply #4 on: June 03, 2011, 02:47:43 am »
kccheng: Take a look at the envvar plugin. It does what you want in terms of features (you can set env variables, when your applications is executed from inside C::B).

Hi

Thanks for reply.  Would you mind give me more info ?
I only find this Wiki page:
http://wiki.codeblocks.org/index.php?title=Environment_Variables_plugin
and after reading this page, I don't even know how to use this
plugin ??

Regards
KC

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can I set/create environment variables from Wizard Script ?
« Reply #5 on: June 03, 2011, 10:37:12 am »
Read the page in the wiki again :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline kccheng

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Can I set/create environment variables from Wizard Script ?
« Reply #6 on: June 03, 2011, 11:42:21 am »
Read the page in the wiki again :)
OK, I see what you meant :-) You are focus on C::B can set/get environment variables.
But I keep asking how to access these functions in Wizard script ... my bad.

Thanks
KC

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Can I set/create environment variables from Wizard Script ?
« Reply #7 on: June 03, 2011, 12:21:44 pm »
You can read them from the configuration manager.
Setup some env var sets then close C::B and inspect the default.conf file. The use the API, to read and write to the variables.
Repeat the same with the project file. Probably there is no script hook for changing the current variable set in the project, but it won't be hard to be implemented.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]