Page 1 of 1 1
Topic Options
#182796 - 2007-11-19 06:05 PM SETM command help
litevsky Offline
Lurker

Registered: 2007-11-19
Posts: 2
Hello,

I need to add the following info to the system environment variable of some systems. The variable name is ADSKFLEX_LICENSE_FILE and the value is @midland.

I put this line into my logon script:

SETM "ADSKFLEX_LICENSE_FILE=@midland"

What happens is that the ADSKFLEX_LICENSE_FILE variable gets put in fine, but the @midland value gets put in as <unknown:midland. Basically, I think kix doesn't understand the @ sign.

Any way around this? Can I put quotes around the value like so '@midland'?

Any help would be greatly appreciated.

-phil

Top
#182797 - 2007-11-19 06:20 PM Re: SETM command help [Re: litevsky]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
At the top of your script, write something like:
 Code:
;Script Options
Break On
Dim $RC
$RC = SetOption("Explicit","On")
$RC = SetOption("NoMacrosInStrings","On") ;I presume this line will solve your problem
$RC = SetOption("NoVarsInStrings","On")

;Code
SETM "ADSKFLEX_LICENSE_FILE=@midland"

Top
#182798 - 2007-11-19 06:35 PM Re: SETM command help [Re: litevsky]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
The "@" symbol tells Kix that the word that follows is (likely to be) a macro. (macro - similar to a CONSTANT in other languages, except related to the computer where the script is running, and can be dynamic, such as @DATE)

As such, the "@" symbol is reserved. In order for you to use it, you must use "@@", which is kind of a special macro that represents the "@" symbol. The better solution (as Witto demonstrated) is to tell kix to ignore the "@" character when it is inside of quoted strings by setting the NoMacrosInStrings option. Of course, this requires you to make sure that macros are outside of strings. Something like:
$Mail = @USERID + "@mydomain.org"
Without the NoMacrosInStrings option, the same code would look like:
$Mail = "@USERID@@mydomain.org"

Both methods are valid, but the first example (using NoMacrosInStrings) is considered better coding practices by most of us. The same logic applies to variables and the NoVarsInStrings option.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#182814 - 2007-11-20 03:16 PM Re: SETM command help [Re: Glenn Barnas]
litevsky Offline
Lurker

Registered: 2007-11-19
Posts: 2
Wow thanks everyone!

I used the @@ fix since we may one day incorporate macro strings.

Top
#182889 - 2007-11-21 11:38 PM Re: SETM command help [Re: litevsky]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
 Originally Posted By: litevsky
...since we may one day incorporate macro strings.
I do not get the reason for your fix.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.054 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org