rofo
Posts: 7
Joined: Thu May 10, 2012 7:28 am

Create shortcuts if condition

Hi!

My problem is how do a create a msi – packet that with no property install 4 shortcuts and if a add property shortcut1=1 then it only install shortcut1. The 4 shortcuts points to same setup.exe, the different between the shortcuts are the arguments.
Ex:
If I run my msi -packet, it install 4 shortcuts.
If I run my msi- packet with property shortcut=1, then it should only install shortcut1
If I run my msi- packet with property shortcut=2, then it should only install shortcut2

Thanks
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Create shortcuts if condition

Hello and welcome to Advanced Installer forums,

If you want to condition installation of a shortcut depending of a property value you should condition installation of a dummy component, that should contain your shortcut, from "Organization" page. So, you should create 4 components, containing a dummy resource (i.e. a registry or a file), that will contain your shortcuts. The first component installation will have as install condition: SHORTCUT ="0" OR SHORTCUT = "1". The second component installation will have as install condition: SHORTCUT ="0" OR SHORTCUT = "2" and so on. A shortcut to an installed file can not be moved from its target file component. So, you should create your shortcuts as a shortcut to an external file in order to move it in dummy components.

Please keep in mind that all your shortcuts will be installed only when the SHORTCUT property will contain the "0" value.

In order to achieve what you want this is what you should do:
- Go to the "Registry" page and create a dummy key (i.e. My_Key1) using [New Key] toolbar button. Here create a dummy registry (i.e My_registry1) using [New Value] toolbar button. Then create another three dummy key (i.e. My_Key2, My_Key3, My_Key4) each one containing one registry value (i.e My_registry2, My_registry3, My_registry4).
- Go to the "Organization" page.
- Drag your first shortcut in the My_Key1 component (your dummy component). Select My_Key1 component and in the "Condition" field from the "Component Properties" right pane set the following condition:

Code: Select all

SHORTCUT ="0" OR SHORTCUT = "1"
- Repeat the above step for the other shortcuts and edit the "Condition" field accordingly.
- Build and run your package.

If you have any questions let me know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rofo
Posts: 7
Joined: Thu May 10, 2012 7:28 am

Re: Create shortcuts if condition

Thanks

Return to “Building Installers”