If/then question:Check for OS version and install based on it?

Warning: I am a total newbie, so thanks in advance for your patience. Three questions:

  1. I have a one component (other than Main) package that I want to install to a folder placed on all user’s desktops. How do I write this (see below) and where in Paquet Builder do I put it? I have Paquet Builder 3.2.

"Check for OS version, then do the following, based on the result:


IF Vista, 7 or 8 later, THEN install to %PUBLIC%\Public Desktop

ELSE Unsupported OS, Contact Support"

2 How would I change it to install to only the current user’s desktop in the scenarios above?

3 If you create a custom variable, where and how do you define it?

Documentation is a good start: http://www.installpackbuilder.com/help/variables

To change the destination folder based on OS version, you’ll need custom actions.

You should test the value of the %OSVER% variable defined by PB thanks to Begin If/then conditional actions.

See http://www.installpackbuilder.com/help/variable-list

Thank you. I read the documentation. I understand that you can use If/Then/Else, and %OSVER%>11 or >11, but I am not a programmer and don’t know how to structure the custom action to do what I want, like the action to “install” the package once OSVER is determined… I’ve spent 25 hours trying to learn enough C++ to figure this out, to no avail.
Can you help?

For instance, the following block enables the main component to unpack its files if the OS version is greater than 11. Otherwise, files won’t be unpacked.

Select the following code and copy it to the clipboard.
Use Actions Tools / Paste Block to import it.

<?xml version="1.0" encoding="utf-8"?>
<pbgroup><action GUID="J4U2R"><type>TCheckValInfo</type><desc>If %OSVER% &gt; 11 then</desc><img>20</img><prop><Variable1>%OSVER%</Variable1><Variable2>11</Variable2><Operator>GreaterThan</Operator></prop></action><action GUID="V4HIF"><type>TModVarInfo</type><desc>Set &quot;%VCOMPMAIN%&quot; to this value &quot;1&quot;</desc><img>10</img><prop><Value>1</Value><Variable>%VCOMPMAIN%</Variable></prop></action><action GUID="SUBPP"><type>TCheckElseValInfo</type><desc>Else</desc><img>20</img><prop/></action><action GUID="1BISH"><type>TModVarInfo</type><desc>Set &quot;%VCOMPMAIN%&quot; to this value &quot;0&quot;</desc><img>10</img><prop><Value>0</Value><Variable>%VCOMPMAIN%</Variable></prop></action><action GUID="AGI1J"><type>TEndValInfo</type><desc>End If</desc><img>20</img><prop/></action></pbgroup>