Evaluate Expression and strings with dollar signs

Got a problem you cannot solve? Try here.
Post Reply
Christoph Schneegans
Posts: 55
Joined: Tue Jan 09, 2007 12:20 pm

Evaluate Expression and strings with dollar signs

Post 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...
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post 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.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Christoph Schneegans
Posts: 55
Joined: Tue Jan 09, 2007 12:20 pm

Post 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.
EHz
Posts: 5
Joined: Thu Jun 18, 2009 1:35 pm
Location: USA

Post 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~
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

$NOTFOUND$?
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
EHz
Posts: 5
Joined: Thu Jun 18, 2009 1:35 pm
Location: USA

Post 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.
Post Reply