PDA

View Full Version : Uninstall a Shortcut Created with Actions


Adam
04-28-2008, 11:38 AM
Question:
Uninstall a Shortcut Created with Actions

Answer
This article explains shortcut creation and how to remove shortcuts created by actions.
There are two ways to create shortcuts in Setup Factory. The first is through File Properties and the second is by using a Shell.CreateShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.CreateShortcut.htm) action. All shortcuts created using the File Properties method will be removed automatically when the program is uninstalled, however shortcuts created with the Shell.CreateShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.CreateShortcut.htm) action will not be removed automatically.

In order to remove shortcuts created using a Shell.CreateShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.CreateShortcut.htm) action, a Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm) action must be used. The best way to accomplish this is to use a Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm) action on the "After Uninstalling" event. Using this method, here is the order of events that will occur during uninstall:

Uninstall starts
- Perform actions listed on the "Before Uninstalling" tab
- Remove files installed by setup
- Remove shortcuts created from File Properties
- Remove folders created by setup
- Other uninstall functions
- Perform actions listed on the "After Uninstalling" tab
- Uninstall shuts down

Note: Placing the Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm) action on the "Before Uninstalling" event will generally work as well as having them on the "After Uninstalling" event. Although it is recommended that the Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm) action be placed on the After Uninstalling tab to insure that all files are deleted before the shortcuts to them are.

Example:

Here is an example of an action that creates a shortcut in the Start Menu:
Shell.CreateShortcut(SetupData.GetAppShortcutFolde rPath(), "My Shortcut", SessionVar.Expand("%AppFolder%\\file.exe")); (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.CreateShortcut.htm)
--GetAppShortcutFolderPath is used so the shortcut is created where it is suposed to be.

Since we created this shortcut with an action, we will have to remove it with a Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm) action on the "After Uninstalling" event. Here is the Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm) action that will accomplish this:


Shell.DeleteShortcut(SetupData.GetAppShortcutFolde rPath(), "My Shortcut");
Notice that the Folder and Shortcut description fields for both actions are identical.


In general any Shell.CreateShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.CreateShortcut.htm) action should have a corresponding Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm) action on the "After Uninstalling" event to ensure that all shortcuts are uninstalled properly.

MORE INFORMATION

For more information please see the following topics in the Setup Factory Help:

Program Reference | Actions | Shell | Shell.CreateShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.CreateShortcut.htm)
Program Reference | Actions | Shell | Shell.DeleteShortcut (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Shell.DeleteShortcut.htm)