gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Create Custom Shortcut

Is there a way I can conditionally create a shortcut? I basically need 2 shortcuts - but only one will get installed based on the features selected.

One shortcut will not have any arguments and the another shortcut will have an argument.

I need to check to see if a feature is selected and if so, then add the shortcut with the argument, otherwise add a shortcut without the argument. Do I do this in the Custom Actions section and if so, how?

Thanks,
Greg
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Create Custom Shortcut

Hi Greg,

Here's an article to help you with this.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Re: Create Custom Shortcut

Thanks but I still don't understand how to do this.

I can't set the condition of a shortcut so I'm not sure how this helps.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Create Custom Shortcut

Hi Greg,
I can't set the condition of a shortcut so I'm not sure how this helps.
Have you read and followed the "Condition the creation of the shortcut" section of the user guide article I linked previously?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Re: Create Custom Shortcut

Yea I did but I don't need a checkbox.

So, I have a feature list that has 1 feature with 2 sub features. If none of the subfeatures are selected for install, then I need to create a shortcut with the argument. If either of the subfeatures ARE selected for install, then I don't need the argument.

I'm not sure how to do that.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Create Custom Shortcut

Hello,

You can follow the article without implementing the checkbox part to understand how to add a condition for your shortcut. You can then condition the shortcut using something like:

Code: Select all

(&SubFeatureOneIdentifier=3) AND (&SubFeatureTwoIdentifier=3)
All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Re: Create Custom Shortcut

Conditioning the shortcut is the problem. I do not see where this can be done. I created the registry value but then I don't understand this step:

"move the shortcut into the component of the registry value you created"

It is already where it needs to be. Where do I condition the shortcut and what is the registry value for?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Create Custom Shortcut

Hello,
Conditioning the shortcut is the problem. I do not see where this can be done.
This can be done from the Organization page by selecting the component. In the right pane the Condition field is in the General group.
"move the shortcut into the component of the registry value you created"
This is also done in The Organization page by drag&drop.
what is the registry value for?
The registry value is so you have a new component to place your shortcut in. After adding the shortcut to the component you can delete the registry value.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Re: Create Custom Shortcut

Again, I cannot move the shortcut to the registry component I created. See attached. The blue arrow is pointing to the shortcut I made. the red arrow is pointing to the registry component I made. When I try to drag the shortcut to the registry component, nothing happens. The cursor doesn't change to a hand or red circle with a line through it - nothing. I can drag the registry item to a different component but that isn't what I need to do.

What is the problem?
Attachments
shortcutproblem.png
shortcutproblem.png (19.69 KiB) Viewed 14443 times
gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Re: Create Custom Shortcut

Update: So the shortcut I initially created was of the type "Installed FIle Shortcut (Windows Installer)". I created a new one to an external file and it put it under the registry component. However, after I added it to the registry component, I went back and deleted the registry value I had created per your instruction, and the entire component was deleted. So, apparently I have to have that registry value created even though it doesn't do anything. I'm not liking having a component that doesn't do anything but if I can make this work, then fine.

The other thing I think is going to be a problem is that I cannot have 2 shortcuts with the same name. How you do get around that problem?
gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Re: Create Custom Shortcut

Update 2: I was able to create 2 shortcuts with the same name by simply adding a space at the end of the name on the second shortcut.

So, now, I have 2 registry components - 1 for the shortcut that needs the argument and 1 for the shortcut that doesn't need the argument. I have put each shortcut in its respective component.

My problem: The shortcut with the condition of (&Radiant<>3 AND &Elo<>3) is always getting installed even if one of these subfeatures is selected. The condition I have on the other component looks like this: (&Radiant=3 OR &Elo=3) which doesn't work either.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Create Custom Shortcut

Hello,
However, after I added it to the registry component, I went back and deleted the registry value I had created per your instruction, and the entire component was deleted.
Indeed, this is happening because the shortcut cannot become a key resource for that component. I had tested this with another type of resource. Every component has a key resource that can be either a file, a folder, a registry key or value or a data source.
The other thing I think is going to be a problem is that I cannot have 2 shortcuts with the same name. How you do get around that problem?
I'm afraid I don't understand this. Why do you need two shortcuts with identical names in the same location? The correct approach to install resources with same name in same location is described here.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
gknierim
Posts: 42
Joined: Wed Jan 18, 2012 3:57 pm

Re: Create Custom Shortcut

Because I need a different shortcut created based on which features they install. Read the previous posts.

So, now, I have 2 registry components - 1 for the shortcut that needs the argument and 1 for the shortcut that doesn't need the argument. I have put each shortcut in its respective component.

My problem: The shortcut with the condition of (&Radiant<>3 AND &Elo<>3) is always getting installed even if one of these subfeatures is selected. The condition I have on the other component looks like this: (&Radiant=3 OR &Elo=3) which doesn't work either.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Create Custom Shortcut

Hi Greg,

Can you please send us the .AIP ( project file ) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Create Custom Shortcut

Hi Greg,

Since the shortcuts are basically the same, but with different arguments, you can try a simpler approach:
- use only one shortcut
- in its Arguments field use a custom installer property, for example [SHORTCUT_ARGUMENTS]
- in Custom Actions page show InstallInitialize action in InstallExecuteSequence
- create a Property set with formatted custom action under InstallInitialize
- configure it to set your custom property to the shortcut argument you want
- condition the custom action to run only when the argument feature is installed

By default any custom property is empty. So your shortcut won't have an argument. But if the argument feature is installed, the property is set and your shortcut will have an argument.

Regarding the duplicate shortcuts approach, instead of conditioning each component you can simply place them in the appropriate features:
- the no-argument component in the no-argument feature
- the argument component in the argument feature

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”