Video Screencast Help

If Expression True

Created: 19 Nov 2012 • Updated: 21 Nov 2012 | 7 comments
This issue has been solved. See solution.

Hi,

I've been trying to get this working for the last hour now and I just can't get the correct syntax needed to make it work, wondered if someone could help us quickly.

This is just a sample of the Wise Script I'm working on (WiseScript Editor 8)

Basically, all I need to do is collect a few values from the registry and then set a windows property if more than one of these values are set to 1, using the Expression True option in an IF statement, see below:
 

Get Registry Key Software\Microsoft\MSDTC\Security place in Variable MSDTC-TRANSLU-32
Get Registry Key Software\Microsoft\MSDTC\Security place in Variable MSDTC-NETDTC-32

If Expression True "%MSDTC-TRANSLU-32% = 1 AND %MSDTC-NETDTC-32% = 1" then
Set Windows Installer Property MSDTC to 1

I can't figure out the correct way to get the Expression True option working when using the IF statement. I know that I properly need to surround my compile variables in % but that throws an 'Invalid expression was specified error' when I hit compile. I think it should look like the below when it's done correctly but I'm doing something wrong... I can't get it to look like the below in the script view, if you see what I mean.

IF Expression True
(Value=A) OR (Value=B) OR (Value=C)
then

On the left hand side of the screen, I'm selecting the 'If Statement' and then when the box appears, I select 'Expression True' from the drop down list and then in the 'Value' field I'm typing in %MSDTC-TRANSLU-32% = "1" AND %MSDTC-NETDTC-32% = "1"

 

Discussion Filed Under:

Comments 7 CommentsJump to latest comment

VBScab's picture

In WI-speak, environment variables are referenced with only one '%' symbol. You also need to enclose the entire string in square brackets, as EVs are treated as special proeprties. Thus, this:

[%MSDTC-TRANSLU-32]=1AND [%MSDTC-NETDTC-32]=1

should work.

http://blogs.msdn.com/b/windows_installer_team/archive/2005/09/16/461742.aspx

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.

EdT's picture

Ian - this is a WISESCRIPT question, so variables do indeed need a % at each end.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

EdT's picture

@Paul1977

Try without the double quotes. Wisescript does not always work correctly when double quotes are used in the wrong places.

Also, try single stepping through the code and monitor the values of the variables to ensure that things are working as you require.

Let me know if you still have problems

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

SOLUTION
Paul1977's picture

Ok, thanks for both your comments, I'll give this a go later on and let you know what happens.

VBScab's picture

I'll get me coat....

Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.

Paul1977's picture

Right, so...

Got a full installation on the go here with lots of MSI's all doing different stuff... will probably have to come up with some idea on how to merge them into a single install at some point, that's when we get around to upgrading to Admin Studio, but in the meantime back to this...

 

Finally got it working with this....

"%MSDTC-TRANSLU-32% = 1 AND %MSDTC-NETDTC-32% = 1"

Actually it looks the same as what I first posted but when you look at it on the script page, it actually shows as:

""%MSDTC-TRANSLU-32% = 1 AND %MSDTC-NETDTC-32% = 1""

I had to wrap the whole expression in double quotes to get it working. Although that's how I posted it first off, I hadn't actualy set any quotes in the Value field.

Thanks again,
Paul

EdT's picture

That's the wonderful world of Wisescript for you ;-)   Sometimes you don't need quotes when you think they should be there, and other times you need extra quotes.  There is a Samples folder in the installation folders which contains a number of example wisescripts, and if I recall correctly, there are one or two Evaluate Expression examples. So always worth a look in there, and also in the online Dragonsoft wisescript library.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.