Environment Variable with ( in it

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
WinstonJenks
Posts: 36
Joined: Fri Jan 01, 2010 12:11 am

Environment Variable with ( in it

Post by WinstonJenks » Fri Mar 04, 2011 5:17 am

Ok folks, in Windows, how do I get the value of the environment variable, ProgramFiles(x86)? Put $ProgramFiles(x86) in the message box gives: Message execution error:\nError description: Function: error in function handler.

I tried...
the Unix way: $(ProgramFiles(x86))...nah,
a Perlish way: ${ProgramFiles(x86)}...nah,
if Windows had a brain way: $"ProgramFiles(x86)"...nah,
single quote way: $'ProgramFiles(x86)'...nah, nah, nah. <US_local_joke>At this point a white duck shows up to save the day.</US_local_joke>

Finally, shell("echo %ProgramFiles(x86)%") worked, but it flashes up a distracting cmd prompt window. Maybe there is a better way?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Environment Variable with ( in it

Post by BvG » Fri Mar 04, 2011 3:04 pm

because rev can't have brackets in variables, it can't show that env var to you. One could argue that's a bug, and I think it's entered in the database somewhere. Going trough Shell is actually the correct workaround, and as long as you set the hideConsoleWindows to true, it won't flash annoyingly.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

WinstonJenks
Posts: 36
Joined: Fri Jan 01, 2010 12:11 am

Re: Environment Variable with ( in it

Post by WinstonJenks » Sat Mar 05, 2011 12:39 am

Thanks for the hideConsoleWindows idea! That will work for me.

Post Reply