ExistsDisk Example

InstallShield 2022 ยป InstallScript Language Reference

Note:To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

/*--------------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the ExistsDisk function.

*

* AskText is called to get a disk drive name from the user.

* Then, ExistsDir is called to determine whether the drive

* exists.

*

\*--------------------------------------------------------------*/

 

#define TITLE_TEXT "ExistsDisk Example"

 

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

 

export prototype ExFn_ExistsDisk(HWND);

 

function ExFn_ExistsDisk(hMSI)

    STRING svDrive;

begin

 

    if (AskText ("Enter the letter of a disk drive.", "C", svDrive) = NEXT) then

        // Check for the existence of the specified drive.

        if (ExistsDisk (svDrive) = EXISTS) then

            SprintfBox (INFORMATION, TITLE_TEXT, "Drive %s exists.", svDrive);

        else

            SprintfBox (INFORMATION, TITLE_TEXT, "Drive %s does not exist",

svDrive);

        endif;

    endif;

 

end;