Boolean paramaters

9 messages Options
Embed this post
Permalink
sandun css

Boolean paramaters

Reply Threaded More More options
Print post
Permalink
Hi,

I have some conditions in my msi, like the following,


<Condition Message="Required prerequisite (PowerShell 1.0) is not found.">

<![CDATA[Installed OR (POWERSHELL >= "1.0")]]>

</Condition>

But I need to run these conditions only if a certain parameter is set to
'true'. (i.e. msiexec /i installer.msi MYFLAG=true)

Are there boolean parameters, or do I need to treat 'true' and 'false'
valuse as strings?

Thanks,

Sandun
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Sebastian Brand (Instyler Software)

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink
Hello,

All values except 0 and "" (empty string) are interpreted as TRUE. So you
may use the condition
MYFLAG AND (Installed OR (POWERSHELL >= "1.0"))

and have the commandline "msiexec /i installer.msi MYFLAG=anyvalue"



Best regards,
Sebastian Brand

Instyler Setup - Creating WiX-based MSI installations, elegantly.
http://www.instyler.com


-----Original Message-----
From: sandun css [mailto:[hidden email]]
Sent: Wednesday, July 01, 2009 6:21 AM
To: [hidden email]
Subject: [WiX-users] Boolean paramaters

Hi,

I have some conditions in my msi, like the following,


<Condition Message="Required prerequisite (PowerShell 1.0) is not found.">

<![CDATA[Installed OR (POWERSHELL >= "1.0")]]>

</Condition>

But I need to run these conditions only if a certain parameter is set to
'true'. (i.e. msiexec /i installer.msi MYFLAG=true)

Are there boolean parameters, or do I need to treat 'true' and 'false'
valuse as strings?

Thanks,

Sandun
----------------------------------------------------------------------------
--
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
John Ludlow

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink
In reply to this post by sandun css
Well, under MSI evaluation logic, if you just use MYFLAG as your
condition, that will evaluate to true as long as MYFLAG has any value
at all.  If you wanted to support MYFLAG=false on the command line and
have the condition evaluate to false, then you would need to check
MYFLAG against a value (in this case that would be "true").

The convention for true/false is to use 1, as in MYFLAG=1 on the
command line, and simply check for MYFLAG having a value.

John

2009/7/1 sandun css <[hidden email]>:

> Hi,
>
> I have some conditions in my msi, like the following,
>
>
> <Condition Message="Required prerequisite (PowerShell 1.0) is not found.">
>
> <![CDATA[Installed OR (POWERSHELL >= "1.0")]]>
>
> </Condition>
>
> But I need to run these conditions only if a certain parameter is set to
> 'true'. (i.e. msiexec /i installer.msi MYFLAG=true)
>
> Are there boolean parameters, or do I need to treat 'true' and 'false'
> valuse as strings?
>
> Thanks,
>
> Sandun
> ------------------------------------------------------------------------------
> _______________________________________________
> WiX-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Christopher Karper

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink
In reply to this post by sandun css
You have a boolean operator right in that very example...   I'm just winging
this, but try:
<Condition Message="Required prerequisite (PowerShell 1.0) is not found.">

<![CDATA[Installed OR ((POWERSHELL >= "1.0") And (MYFLAG))]]>

</Condition>

On Wed, Jul 1, 2009 at 12:21 AM, sandun css <[hidden email]> wrote:

> Hi,
>
> I have some conditions in my msi, like the following,
>
>
> <Condition Message="Required prerequisite (PowerShell 1.0) is not found.">
>
> <![CDATA[Installed OR (POWERSHELL >= "1.0")]]>
>
> </Condition>
>
> But I need to run these conditions only if a certain parameter is set to
> 'true'. (i.e. msiexec /i installer.msi MYFLAG=true)
>
> Are there boolean parameters, or do I need to treat 'true' and 'false'
> valuse as strings?
>
> Thanks,
>
> Sandun
>
> ------------------------------------------------------------------------------
> _______________________________________________
> WiX-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Buddell, James

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink
>From memory so this may not be 100% - Windows Installer evaluates
properties as true if they are set, and false if they are not. i.e.
setting MYFLAG=true on the command line will result in boolean condition
tests on MYFLAG returning true, but so will setting MYFLAG=false, as the
MYFLAG property will be set to the string false.

So you'll need to use string comparison tests, and you'll probably want
to use MYFLAG~="true" which will perform a case-insensitive string
comparison, i.e. true for MYFLAG=True or MYFLAG=true, but not for
MYFLAG=false.

Cheers,
James

-----Original Message-----
From: Christopher Karper [mailto:[hidden email]]
Sent: 01 July 2009 12:25
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Boolean paramaters

You have a boolean operator right in that very example...   I'm just
winging
this, but try:
<Condition Message="Required prerequisite (PowerShell 1.0) is not
found.">

<![CDATA[Installed OR ((POWERSHELL >= "1.0") And (MYFLAG))]]>

</Condition>

On Wed, Jul 1, 2009 at 12:21 AM, sandun css <[hidden email]> wrote:

> Hi,
>
> I have some conditions in my msi, like the following,
>
>
> <Condition Message="Required prerequisite (PowerShell 1.0) is not
found.">
>
> <![CDATA[Installed OR (POWERSHELL >= "1.0")]]>
>
> </Condition>
>
> But I need to run these conditions only if a certain parameter is set
to

> 'true'. (i.e. msiexec /i installer.msi MYFLAG=true)
>
> Are there boolean parameters, or do I need to treat 'true' and 'false'
> valuse as strings?
>
> Thanks,
>
> Sandun
>
>
------------------------------------------------------------------------
------
> _______________________________________________
> WiX-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------
------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
This e-mail is confidential and the information contained in it may be
privileged. It should not be read, copied or used by anyone other than the
intended recipient.  If you have received it in error, please contact the sender
immediately by telephoning (+44 (0)20 7623 8000) or by return email, and delete
the e-mail and do not disclose its contents to any person.  We believe, but do
not warrant, that this e-mail and any attachments are virus free, but you must
take full responsibility for virus checking. Please refer to
http://www.dresdnerkleinwort.com/disc/email/ and read our e-mail disclaimer
statement and monitoring policy.

Dresdner Kleinwort is a brand and trading name of the Commerzbank group and
operates through Commerzbank AG, Dresdner Kleinwort Limited and their affiliated
or associated companies.  Commerzbank AG is a company incorporated in Germany
with limited liability and registered in England (registered no. FC008139, place
of business 60 Gracechurch Street, London EC3V 0HR) and is authorised by
Bundesanstalt fuer Finanzdienstleistungsaufsicht (BaFin) and authorised and
subject to limited regulation by the Financial Services Authority (FSA).
Dresdner Kleinwort Limited is a company incorporated in England with limited
liability (registered no. 551334, registered office 30 Gresham Street, London
EC2V 7PG) and is authorised and regulated by the FSA.  Details about the extent
of our authorisations and regulation are available on request.


------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Wilson, Phil

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink
That's correct - they're uncomfortably like some C /C++ types, to use that as an approximate analogy.  People trip over this sometimes with the standard properties. For example the Installed property isn't set to true or false. It's a string which (IIRC) is a date.

Phil Wilson

-----Original Message-----
From: Buddell, James [mailto:[hidden email]]
Sent: Wednesday, July 01, 2009 6:04 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Boolean paramaters

>From memory so this may not be 100% - Windows Installer evaluates
properties as true if they are set, and false if they are not. i.e.
setting MYFLAG=true on the command line will result in boolean condition
tests on MYFLAG returning true, but so will setting MYFLAG=false, as the
MYFLAG property will be set to the string false.

So you'll need to use string comparison tests, and you'll probably want
to use MYFLAG~="true" which will perform a case-insensitive string
comparison, i.e. true for MYFLAG=True or MYFLAG=true, but not for
MYFLAG=false.

Cheers,
James

-----Original Message-----
From: Christopher Karper [mailto:[hidden email]]
Sent: 01 July 2009 12:25
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Boolean paramaters

You have a boolean operator right in that very example...   I'm just
winging
this, but try:
<Condition Message="Required prerequisite (PowerShell 1.0) is not
found.">

<![CDATA[Installed OR ((POWERSHELL >= "1.0") And (MYFLAG))]]>

</Condition>

On Wed, Jul 1, 2009 at 12:21 AM, sandun css <[hidden email]> wrote:

> Hi,
>
> I have some conditions in my msi, like the following,
>
>
> <Condition Message="Required prerequisite (PowerShell 1.0) is not
found.">
>
> <![CDATA[Installed OR (POWERSHELL >= "1.0")]]>
>
> </Condition>
>
> But I need to run these conditions only if a certain parameter is set
to

> 'true'. (i.e. msiexec /i installer.msi MYFLAG=true)
>
> Are there boolean parameters, or do I need to treat 'true' and 'false'
> valuse as strings?
>
> Thanks,
>
> Sandun
>
>
------------------------------------------------------------------------
------
> _______________________________________________
> WiX-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------
------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
This e-mail is confidential and the information contained in it may be
privileged. It should not be read, copied or used by anyone other than the
intended recipient.  If you have received it in error, please contact the sender
immediately by telephoning (+44 (0)20 7623 8000) or by return email, and delete
the e-mail and do not disclose its contents to any person.  We believe, but do
not warrant, that this e-mail and any attachments are virus free, but you must
take full responsibility for virus checking. Please refer to
http://www.dresdnerkleinwort.com/disc/email/ and read our e-mail disclaimer
statement and monitoring policy.

Dresdner Kleinwort is a brand and trading name of the Commerzbank group and
operates through Commerzbank AG, Dresdner Kleinwort Limited and their affiliated
or associated companies.  Commerzbank AG is a company incorporated in Germany
with limited liability and registered in England (registered no. FC008139, place
of business 60 Gracechurch Street, London EC3V 0HR) and is authorised by
Bundesanstalt fuer Finanzdienstleistungsaufsicht (BaFin) and authorised and
subject to limited regulation by the Financial Services Authority (FSA).
Dresdner Kleinwort Limited is a company incorporated in England with limited
liability (registered no. 551334, registered office 30 Gresham Street, London
EC2V 7PG) and is authorised and regulated by the FSA.  Details about the extent
of our authorisations and regulation are available on request.


------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Richard-45

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink

Think of "boolean" properties acting the same way that properties act
when you connect them to a checkbox.  The property is empty if the
checkbox is cleared and set to some value when the checkbox is
checked.

If you follow this convention with your own properties then MyProperty
will evaluate to true when MyProperty has some non-empty value and
evaluate to false when it is empty.

To set a property to the empty value use a type 19 CA with the value
"{}".  This is discussed in the Windows Installer documentation.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
      <http://www.xmission.com/~legalize/book/download/index.html>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
sandun css

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink
Thanks for the replies. I was able to get it done with 'MYFLAG~="true"'
approach.
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users
Richard-45

Re: Boolean paramaters

Reply Threaded More More options
Print post
Permalink
In reply to this post by Sebastian Brand (Instyler Software)

In article <000001c9fa0f$da2a52b0$8e7ef810$@com>,
    "Sebastian Brand \(Instyler Software\)" <[hidden email]>  writes:

> All values except 0 and "" (empty string) are interpreted as TRUE.

Good point.  I forgot about 0.  But I generally use empty string for
false.

> So you
> may use the condition
> MYFLAG AND (Installed OR (POWERSHELL >= "1.0"))

Note that POWERSHELL >= "1.0" doesn't really do version comparisons, its
a string compare.  This can fail in weird ways if you're not careful.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
      <http://www.xmission.com/~legalize/book/download/index.html>

      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wix-users