Page 1 of 1

Evaluate Expression and strings with dollar signs

Posted: Thu Jan 25, 2007 9:59 am
by Christoph Schneegans
Hello!

When I use the "Check Registry", I want to ensure that no error occured.

Code: Select all

Evaluate Expression $reg$ = "UNKNOWN$TYPE" or $reg$ = "BINARY$VALUE" or $reg$ = "NO$VALUE" or $reg$ = "NO$KEY" or $reg$ = "READ$ERROR" into variable error
should do it. Unfortunately, the compiler complains about this line: "Syntax error in expression. Please review the help topic 'Evaluate Expression for the correct syntax." Well, in my opinion, I do use the correct syntax...

Posted: Thu Jan 25, 2007 2:05 pm
by MichaelNesmith
Nice catch! I believe the Evaluate Expression command is being confused by the "$" signs, which is not normally an issue with script commands (and no escaping is normally required).

To workaround, why don't you assign variables to the values that you are comparing to, and in the meantime I'll have this bug logged with R&D so they can address it in an update.

Posted: Fri Jan 26, 2007 3:53 am
by Christoph Schneegans
I think that

Code: Select all

Set Variable error to FALSE
if Variable reg Equals UNKNOWN$TYPE
  Set Variable error to TRUE
end
if Variable reg Equals BINARY$VALUE
  Set Variable error to TRUE
end
if Variable reg Equals NO$VALUE
  Set Variable error to TRUE
end
if Variable reg Equals NO$KEY
  Set Variable error to TRUE
end
if Variable reg Equals READ$ERROR
  Set Variable error to TRUE
end
if Variable error Equals TRUE
  ...
end
would be the best workaround since it does not introduce much overhead.

Posted: Fri Jun 19, 2009 2:38 am
by EHz
Is this still a problem requiring a workaround?

I am getting the same error with the following:

Code: Select all

Evaluate Expression
($WORD_8_KEY$ <> $NOTFOUND$) OR ($WORD_9_KEY$ <> $NOTFOUND$) OR ($WORD_10_KEY$ <> $NOTFOUND$) OR ($WORD_11_KEY$ <> $NOTFOUND$) into Is_Word_8_to_11
Note: I cleaned up the above. What I get when I copy the line and paste directly in here:

Code: Select all

~InstallAware Clipboard Data~
~Evaluate Expression~
~{E2105B02-704A-4ADC-BBD1-AFB1315A8DB9}~
~($WORD_8_KEY$ <> $NOTFOUND$) OR ($WORD_9_KEY$ <> $NOTFOUND$) OR ($WORD_10_KEY$ <> $NOTFOUND$) OR ($WORD_11_KEY$ <> $NOTFOUND$) ~
~Is_Word_8_to_11~

Posted: Fri Jun 19, 2009 11:30 am
by MichaelNesmith
$NOTFOUND$?

Posted: Fri Jun 19, 2009 11:44 am
by EHz
Yes, NOTFOUND is a variable containing a value, just like WORD_9_KEY, etc. These happen to both be strings. NOTFOUND is a default return value in case a registry key does not exist.

The IA Help for Evaluate Expression says to enclose these in $:

A token is either a string literal or a variable. String literals must be enclosed in double quotes. Variables must be enclosed between "$" signs. An example string literal token would be "this is a string". An example variable token would be $EXAMPLE_VAR$.

An example expression would be: $A$ = "value1" or ($B$ = "value2" and $C$ = "value3"). In this example, A, B, and C are regular script variables. The expression evaluates to TRUE if variable A holds the value value1, or variable B holds the value value2 together with variable C holding the value value3. All three variables must have been defined before the Evaluate Expression command executes to avoid runtime errors.


So why isn't it working?

This problem might come from the fact that this project started by converting a Wise .wse file. Perhaps conversion works for trivial projects, but I have found many prost-conversion problems.