Specifying a Component’s Destination from the Script

InstallShield 2024

Project: This information applies to InstallScript projects.

Specifying the target destination of a component’s files from the script lets you change that destination at run time based on end-user input or other conditions.

To specify the target destination of a component’s files from the script:

1. In the View List under Application Data, click Files and Folders.
2. In the Destination computer’s folders pane, right-click Script-defined Folders and click New Folder. InstallShield adds a subfolder with the default name <NEW VARIABLE N>, where N is a successive number. You can rename this subfolder to any string that is enclosed in angle brackets; for example, <My Script-defined Folder>.
3. To specify the target destination of an existing component’s files:
a. In the View List under Organization, click Components or Setup Design.
b. Select the component that you want to configure.
c. In the component’s property grid, click the value of the Destination property and in the list, select the name of the subfolder that you created in step 1.

To create a new component and specify the target destination of its files:

a. In the Files and Folders view, drag the desired file or files from the Source computer’s folders pane and drop them on the subfolder that you created in step 1. InstallShield creates a new component with the default name FilesN.
b. In your script, call FeatureSetTarget to assign a target location to the subfolder that you created in step 1; for example:

AskDestPath( "" , "Choose a location for the XYZ files." , svEndUserSelectedPath, 0 );

FeatureSetTarget( MEDIA , "<My Script-defined Folder>" , svEndUserSelectedPath);