Author Topic: Cannot invoke Environment Variable in Macro  (Read 2666 times)

RG_Basser

  • Community Member
  • Posts: 20
  • Hero Points: 0
Cannot invoke Environment Variable in Macro
« on: January 26, 2007, 01:58:26 pm »
Hi, I've got a problem.

I wrote some macros in vs and all of them use the same path description. So I wanted to replace these path descriptions with an environment variable but everything I tried nothing happened.
I tried it with 'set VARIABLE=<path>' in the command line of vs and also with the same statement under 'Workspace Properties/Environment Variables' (what would be the best solution for me because the path relies to a special project path). Even putting it under vslick.ini didn't work. ???
Then I tried it with 'set_env(...)' but with the same result!  :'(

Everytime I try to assign the value of the environment variable to a _str (with %VARIABLE% or get_env()) nothing happens!! >:(

Any ideas? Thanx a lot!

jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: Cannot invoke Environment Variable in Macro
« Reply #1 on: January 26, 2007, 06:15:47 pm »
Hi,

FWIW, this works for me:


  _str my_str = get_env("XYZ");
  message(my_str);


I can set the variable using set XYZ=something on the command line.

What's your code?

Does your variable show in the buffer when you enter the set command with no parameters?

John Hurst

RG_Basser

  • Community Member
  • Posts: 20
  • Hero Points: 0
Re: Cannot invoke Environment Variable in Macro
« Reply #2 on: January 29, 2007, 09:13:55 am »
@jbhurst
It seems I didn't use get_env correctly (I think I forgot the quotes  :-\). Now I use it like you suggested and it works. Thanks a lot!  ;D